Q7:The electricity accounts of residents in a very small town are calculated as follows: > if 500 units or less are used the cost is 2 cents per unit; > if more than 500, but not more than 1000 units are used, the cost is $10 for the first 500 units, and then 5 cents for every unit in excess of 500; > if more than 1000 units are used, the cost is $35 for the first 1000 units plus 10 cents for every unit in excess of 1000; > in addition, a basic service fee of $5 is charged, no matter how much electricity is used. Q8:Write a program which enters the following five consumptions into a vector, and uses a for loop to calculate and display the total charge for each one: 200, 500, 700, 1000, 1500. (Answers: $9, $15, $25, $40, $90)

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter4: Making Decisions
Section: Chapter Questions
Problem 16RQ
icon
Related questions
Question
Q7:The electricity accounts of residents in a very small town are
calculated as follows:
if 500 units or less are used the cost is 2 cents per unit;
> if more than 500, but not more than 1000 units are used, the cost is
$10 for the first 500 units, and then 5 cents for every unit in excess of
500;
> if more than 1000 units are used, the cost is $35 for the first 1000 units
plus 10 cents for every unit in excess of 1000;
in addition, a basic service fee of $5 is charged, no matter how much
electricity is used.
Q8:Write a program which enters the following five consumptions into a
vector, and uses a for loop to calculate and display the total charge for
each one: 200, 500, 700, 1000, 1500. (Answers: $9 $15, $25, $40, $90)
Transcribed Image Text:Q7:The electricity accounts of residents in a very small town are calculated as follows: if 500 units or less are used the cost is 2 cents per unit; > if more than 500, but not more than 1000 units are used, the cost is $10 for the first 500 units, and then 5 cents for every unit in excess of 500; > if more than 1000 units are used, the cost is $35 for the first 1000 units plus 10 cents for every unit in excess of 1000; in addition, a basic service fee of $5 is charged, no matter how much electricity is used. Q8:Write a program which enters the following five consumptions into a vector, and uses a for loop to calculate and display the total charge for each one: 200, 500, 700, 1000, 1500. (Answers: $9 $15, $25, $40, $90)
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Avoiding deadlock
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning