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
Which of the following is not a storage medium?
GarryVolchara [31]

Answer:

microphone

Explanation:

when you are using a microphone once it stop it done

8 0
3 years ago
Read 2 more answers
All of the following are aspects of the search process except
Len [333]
You need to provide the options or we cant provide you with the incorrect answer.
8 0
3 years ago
(15 POINTS + BRAINLIEST) My friend is trying to make an account on brainly, but she can't sign in. All it just says is, “We cann
julia-pushkina [17]
Try a different email and see if that works :)
5 0
3 years ago
Read 2 more answers
Christopher is part of a film production. His job is to analyze the movie script and create a shooting schedule. What is Christo
Oksi-84 [34.3K]
I am pretty sure he would be the production manager
3 0
3 years ago
Read 2 more answers
Mindy wants to create a new subdirectory at ~/2019projects/projectx/projectplans to start storing the initial project plans for
alexgriva [62]

Answer:

b. mkdir -p ~/2019projects/project/projectplans

Explanation:

mkdir command in Linux environment is used to create a new directory. This command is used to create a folder to store the information in organized manners.

-p is used to create a parent folder in the directory. If we want to start a new project or want to store information about some new topic we will create a new folder for that purpose. So, -p is used to create a new folder in directory.

In above mentioned case, this is the first project that Mindy started in 2019, so she should create a parent directory of 2019 to save all projects details that she worked in 2019. So she should use -p with mkdir command to make 2019 as a parent folder.

6 0
3 years ago
Other questions:
  • Tricia listed her assets and liabilities. Credit Card Bill Car Loan Bonds Piano Bank Account Bicycle Which are Tricia’s liabilit
    8·2 answers
  • The largest value (in hex) that can be loaded into Register A of HCS12 is (Points : 2) 0x8.
    9·1 answer
  • In a case where electrical current leakage from the circuit occurs, the GFCI would do the following:
    10·1 answer
  • . Write a short program that asks the user to input a string, and then outputs the
    15·1 answer
  • Match letters from column B to Column A by looking at the picture above.
    11·1 answer
  • Instructions:Type the correct answer in the box. Spell all words correctly.
    9·2 answers
  • Microsoft Publisher - Assignment #1
    7·1 answer
  • Convert pounds to ounces.
    11·2 answers
  • Can somebody hack ur account on Brainly bc I feel like I have bc I have answered waaaaaay more questions than shows on my profil
    13·1 answer
  • What's the commission payout for auto bill pay if sold with a ga?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!