Docsity

Computing Monthly Electric Bill: A Programming Assignment for Math 248 Students - Prof. Ch, Assignments of Mathematics

Toggle sidebar
bg1
COMPUTING YOUR ELECTRIC BILL
Programming Assignment 2 (15 points)
Math 248 Computers and Numerical Algorithms
Spring 2009–Pruett
DATE ASSIGNED: Thursday, 29 January, 2009
DATE DUE: Thursday, 5 February, 2009
BACKGROUND: Harrisonburg Electric Commission (HEC) has the following monthly rate structure
for residential customers:
•Each account is charged a basic fee of $5.00 regardless of how many kilowatt hours (KWH) of
electricity are used.
•In addition, in summer months (June-Sept.), each customer is charged 6.17 cents per KWH for
the first 800 KWH and 6.89 cents per KWH for each KWH in excess of 800.
•On the other hand, in non-summer months, each customer is charged 6.17 cents per KWH for the
first 800 KWH, and 4.85 cents per KWH for each KWH in excess of 800.
ASSIGNMENT: This assignment is to be completed individually. Write a computer program that
computes a monthly electric bill in dollars, given the month of the year as an integer (1-12) and the
meter readings (KWH) at the beginning and end of the month.
CONSIDERATIONS: How many input (output) variables are needed? What type(s) should they be?
Sample data is provided for you on Blackboard under ASSIGNMENTS as pa2 data.txt. Your program
must input the data exactly as it is presented in the sample data file. (Actual data may differ numerically
from the sample data, but it will be formatted identically to the sample data and in the same order.)
Before you start coding, write out the basic decision structure in pseudocode or as a flowchart. Turn
in your pseudocode (or flowchart) by Tuesday, February 3. Be sure your output is intelligible to the
average customer. Once your program is completed and validated, you will submit it electronically
according to a job-submission protocol that will be discussed in class.
This program is to be accomplished solo. As always, you are allowed to discuss programming issues
with other students, but the actual coding of your program should be accomplished individually, you
should document in the preamble any assistance you receive, and your program should be unique.

Partial preview of the text

Download Computing Monthly Electric Bill: A Programming Assignment for Math 248 Students - Prof. Ch and more Assignments Mathematics in PDF only on Docsity!

COMPUTING YOUR ELECTRIC BILL

Programming Assignment 2 (15 points)

Math 248 Computers and Numerical Algorithms Spring 2009–Pruett

DATE ASSIGNED: Thursday, 29 January, 2009

DATE DUE: Thursday, 5 February, 2009

BACKGROUND: Harrisonburg Electric Commission (HEC) has the following monthly rate structure for residential customers:

  • Each account is charged a basic fee of $5.00 regardless of how many kilowatt hours (KWH) of electricity are used.
  • In addition, in summer months (June-Sept.), each customer is charged 6.17 cents per KWH for the first 800 KWH and 6.89 cents per KWH for each KWH in excess of 800.
  • On the other hand, in non-summer months, each customer is charged 6.17 cents per KWH for the first 800 KWH, and 4.85 cents per KWH for each KWH in excess of 800.

ASSIGNMENT: This assignment is to be completed individually. Write a computer program that computes a monthly electric bill in dollars, given the month of the year as an integer (1-12) and the meter readings (KWH) at the beginning and end of the month.

CONSIDERATIONS: How many input (output) variables are needed? What type(s) should they be? Sample data is provided for you on Blackboard under ASSIGNMENTS as pa2 data.txt. Your program must input the data exactly as it is presented in the sample data file. (Actual data may differ numerically from the sample data, but it will be formatted identically to the sample data and in the same order.)

Before you start coding, write out the basic decision structure in pseudocode or as a flowchart. Turn in your pseudocode (or flowchart) by Tuesday, February 3. Be sure your output is intelligible to the average customer. Once your program is completed and validated, you will submit it electronically according to a job-submission protocol that will be discussed in class.

This program is to be accomplished solo. As always, you are allowed to discuss programming issues with other students, but the actual coding of your program should be accomplished individually, you should document in the preamble any assistance you receive, and your program should be unique.