1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
arlik [135]
3 years ago
7

The electric company gives a discount on electricity based upon usage. The normal rate is $.60 per Kilowatt Hour (KWH). If the n

umber of KWH is above 1,000, then the rate is $.45 per KWH. Write a program (L4_Ex1.cpp) that prompts the user for the number of Kilowatt Hours used and then calculates and prints the total electric bill. Please put comment lines, same as in Lab3, at the beginning of your program. According to your program in Lab 4.1, how much will it cost for: 900 KWH? 1,754 KWH? 10,000 KWH?
Computers and Technology
1 answer:
katrin2010 [14]3 years ago
3 0

Answer:

The cpp program for the given scenario is shown below.

#include <stdio.h>

#include <iostream>

using namespace std;

int main()

{

   //variables to hold both the given values

   double normal_rate = 0.60;

   double rate_1000 = 0.45;

   //variable to to hold user input

   double kwh;

   //variable to hold computed value

   double bill;

   std::cout << "Enter the number of kilowatt hours used: ";

   cin>>kwh;

   std::cout<<std::endl<<"===== ELECTRIC BILL ====="<< std::endl;

   //bill computed and displayed to the user

   if(kwh<1000)

   {

       bill = kwh*normal_rate;

       std::cout<< "Total kilowatt hours used: "<<kwh<< std::endl;

       std::cout<< "Rate for the given usage: $"<<normal_rate<< std::endl;

       std::cout<< "Total bill: $" <<bill<< std::endl;

   }

   else  

   {

       bill = kwh*rate_1000;

       std::cout<< "Total kilowatt hours used: "<<kwh<< std::endl;

       std::cout<< "Rate for the given usage: $"<<rate_1000<< std::endl;

       std::cout<< "Total bill: $" <<bill<< std::endl;

   }

   std::cout<<std::endl<< "===== BILL FOR GIVEN VALUES ====="<< std::endl;

   //computing bill for given values of kilowatt hours

   double bill_900 = 900*normal_rate;

   std::cout << "Total bill for 900 kilowatt hours: $"<< bill_900<< std::endl;

   double bill_1754 = 1754*rate_1000;

   std::cout << "Total bill for 1754 kilowatt hours: $"<< bill_1754<< std::endl;

   double bill_10000 = 10000*rate_1000;

   std::cout << "Total bill for 10000 kilowatt hours: $"<< bill_10000<< std::endl;

   return 0;

}

OUTPUT

Enter the number of kilowatt hours used: 555

===== ELECTRIC BILL =====

Total kilowatt hours used: 555

Rate for the given usage: $0.6

Total bill: $333

===== BILL FOR GIVEN VALUES =====

Total bill for 900 kilowatt hours: $540

Total bill for 1754 kilowatt hours: $789.3

Total bill for 10000 kilowatt hours: $4500

Explanation:

1. The program takes input from the user for kilowatt hours used.

2. The bill is computed based on the user input.

3. The bill is displayed with three components, kilowatt hours used, rate and the total bill.

4. The bill for the three given values of kilowatt hours is computed and displayed.

You might be interested in
Write down 5 tips that an office can use to be more sustainable and reduce wastage? Write a description of each one and how it r
Evgen [1.6K]

1 Use water cooler

2 Avoid single use drink container for guests

3 Bring lunches in reusable containers

4 Paper waste reduction

take paperless notes

5 Use both sides of paper while printing, coping and writing

8 0
2 years ago
Outcomes resulting from using incorect requirement specification during system development​
Vlada [557]

Answer:

please give full understandable question buddy

5 0
3 years ago
Help please not trying to fail
deff fn [24]

Answer:

B. Everywhere CFCI is not

8 0
3 years ago
A strong example of using keywords would be a. Using “good” to remember the word “hideous” c. Both of these b. Using “hide” to r
posledela

The answer to the question you have asked is <u><em>"B" . </em></u> Because if you really think about it, there is no possible way that "Good" can be a keyword of "Hideous".

6 0
3 years ago
In the code below, what's the final value of the variable x?
Lana71 [14]

Answer:

First equation x=4

second equation x=3

Explanation:

The question is telling us that 'X' is equal to 8. It's another way of representing this number using X as the variable replacing it.

We input 8 instead of the X to solve the equation, and here in the picture, you can see where I went from there.

Do the same thing for the other equation.

I hope this helps :)

3 0
2 years ago
Other questions:
  • Bob's Assembly is a hardware manufacturer. It specializes in builders' hardware for doors, cabinets, windows, and bathrooms. Bob
    10·1 answer
  • Your mom wants to purchase a computer. She has heard about how the Windows 8 operating system is best-geared for a touch-enabled
    8·1 answer
  • Your grandmother was an established artist and left you several original paintings after she died. Which of these statements is
    6·1 answer
  • The Internet may best be compared to a/an
    8·1 answer
  • What operating system is an open source program
    15·1 answer
  • How can the function anotherFunc2 change the contents of the second element of t?
    5·1 answer
  • When you are working in Performance Monitor, in the "Add Counters" dialog box, and need more information about a particular coun
    8·1 answer
  • Describe two types of storage devices?​
    15·1 answer
  • How do i fix this to make it run ???
    9·1 answer
  • How would you describe binary to someone ??<br> PLEASE ANSWER I WILL GIVE U BRAINLY!!
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!