Answer:
The c# program for the scenario is given below.
using System;
public class Program2 {
double total = 0;
static void Main() {
Program2 ob = new Program2();
Console.WriteLine("Enter total energy used in kilo watts ");
int p;
p = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter type of customer ");
char t;
t = Convert.ToChar(Console.ReadLine());
ob.bill_calculator(p, t);
Console.WriteLine("Total charge for " + p + " kilo watts electricity for " + t + " customers is " + ob.total);
}
public void bill_calculator(int e, char c)
{
int first=500, second = 800;
double chg_one = 0.12, chg_two=0.15, chg_three = 0.16, chg_four = 0.20;
if(c == 'R')
{
if(e <= 500)
{
total = (e * chg_one);
}
else if(e > 500)
{
total = ( first * chg_one);
total = total + ((e-first) * chg_two);
}
}
if(c == 'B')
{
if(e <= 800)
{
total = (e * chg_three);
}
else if(e > 800)
{
total = ( first * chg_three);
total = total + ((e-second) * chg_four);
}
}
}
}
OUTPUT
Enter total energy used in kilo watts
1111
Enter type of customer
B
Total charge for 1111 kilo watts electricity for B customers is 142.2
Explanation:
The program takes user input for the type of customer and the amount of electric current used by that customer.
The two input values decide the rate at which total charge is calculated.
For residential customers, charges are divided into slabs of 500 or less and more than 500.
Alternatively, for business customers, charges are divided into slabs of 800 or less and more than 800.
User input is taken in main function.
Charges are calculated in the bill_calculator method which takes both user input as parameters.
If else block is used to calculate the charges.
No input validation is implemented as it is not mentioned in the question.
All code is written inside the class. An object is created of the class.
The methods outside main() are called using the object of the class.
Answer:
21 times
Explanation:
Following are the description of output:
Answer: (A) Firewall; implement an ACL on the interface
Explanation:
According to the question, for re-mediate the issue firewall should be implemented the ACL (Access control list) on the given interface. The access control list is one of the type of logic which selectively give permission or deny the number of packet in the system which to through the interface.
Firewall is the type of device that basically examine the traffic in the network system and also make several decisions in the system. ACL is the set of rule which mainly define the route of the packet in the router interface state.
Answer:
The clarity factor suggest that if there is lack of clarity communication can do a great deal of damage. The Clarity Factor is a perfect example of a well chosen words and well written sentences can get the most complicated in the message across the number of people in the least amount of the time.
The factors that are vital to achieve clarity in the messages are:
Answer:
The program written in Python is as follows:
See Explanation section for line by line explanation
for n in range(100,1000):
isum = 0
for d in range(1,n):
if n%d == 0:
isum += d
if isum == n * 2:
print(n)
Explanation:
The program only considers 3 digit numbers. hence the range of n is from 100 to 999
for n in range(100,1000):
This line initializes sum to 0
isum = 0
This line is an iteration that stands as the divisor
for d in range(1,n):
This line checks if a number, d can evenly divide n
if n%d == 0:
If yes, the sum is updated
isum += d
This line checks if the current number n is a double-perfect number
if isum == n * 2:
If yes, n is printed
print(n)
When the program is run, the displayed output is 120 and 672
a.1
b.2
c.3
d.4