W is the amount (in litres) of water in the well at the start of the f P is the percentage of the water in the well taken out each day m to print the number of the day, the amount taken for that day ning at the end of the day. The output should be terminated wher or the amount of water remaining is less than 100 litres, whicheve

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

I need your help with the question attached, Your writing your program in C# I have also attached a document about the format I need you to use when writing the code in C#. Please let me know if there are any problems. 

 

string customerName;
int preReading, currentReading;
double difference;
double numberUnits;
double amount0fBills;
Console.WriteLine("Calculating the Electricity Charges of a Customer. ");
Console.Write("Please enter Customer Name: " );
customerName = Console.ReadLine();
Console.Write("Please enter previous meter reading: ");
preReading = Convert.ToInt32(Console.ReadLine());
Console.Write("Please enter current meter reading: ");
currentReading = Convert. ToInt32(Console.ReadLine());
numberUnits = preReading;
difference = currentReading - preReading;
amountOfBills = 25 + difference*0.2;
Console.WriteLine("Customer Name: " +customerName);
Console.WriteLine("Number Of Units used: " + numberUnits);
Console.WriteLine("Amount of Bill: $" + amountOfBills);
}
Transcribed Image Text:string customerName; int preReading, currentReading; double difference; double numberUnits; double amount0fBills; Console.WriteLine("Calculating the Electricity Charges of a Customer. "); Console.Write("Please enter Customer Name: " ); customerName = Console.ReadLine(); Console.Write("Please enter previous meter reading: "); preReading = Convert.ToInt32(Console.ReadLine()); Console.Write("Please enter current meter reading: "); currentReading = Convert. ToInt32(Console.ReadLine()); numberUnits = preReading; difference = currentReading - preReading; amountOfBills = 25 + difference*0.2; Console.WriteLine("Customer Name: " +customerName); Console.WriteLine("Number Of Units used: " + numberUnits); Console.WriteLine("Amount of Bill: $" + amountOfBills); }
Question:
A fixed percentage of water is taken from a well each day.
Request values for W and P where:
- W is the amount (in litres) of water in the well at the start of the first day
·P is the percentage of the water in the well taken out each day
Write a program to print the number of the day, the amount taken for that day and the
amount remaining at the end of the day. The output should be terminated when 30 days have
been printed or the amount of water remaining is less than 100 litres, whichever comes first.
For example, if W = 1000 and P = 10, the output should start as follows:
Day
Amount
Amount
Taken
Remaining
100
900
2
90
810
3
81
729
Note: The amount taken and amount remaining should be displayed to 2 decimal places.
Transcribed Image Text:Question: A fixed percentage of water is taken from a well each day. Request values for W and P where: - W is the amount (in litres) of water in the well at the start of the first day ·P is the percentage of the water in the well taken out each day Write a program to print the number of the day, the amount taken for that day and the amount remaining at the end of the day. The output should be terminated when 30 days have been printed or the amount of water remaining is less than 100 litres, whichever comes first. For example, if W = 1000 and P = 10, the output should start as follows: Day Amount Amount Taken Remaining 100 900 2 90 810 3 81 729 Note: The amount taken and amount remaining should be displayed to 2 decimal places.
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY