1 answer

2. PRACTICAL ASSIGNMENT 2 2.1 Covert the following design into C++. Refer to figure 1 for...

Question:

2. PRACTICAL ASSIGNMENT 2 2.1 Covert the following design into C++. Refer to figure 1 for sample output. Save your source file as runProgram1.cpp. Indude your student number, suname and initials and group at the beginning of the source files as comments. Submit anly the C++ source file. DoBlectricityCalcalations custMom <> 99999 display Enter the leotricity usage in kilowatt-hours Call the anntoving Calohntowing (usage) Cali the aub procedure display EnteE the oustoner nusbeE 199999 to end display The total uaage for li customers istotalosage if valusage200 then anntovingval0sage 2.70 DS017AT anntouing 2002.70valUsage-200) 1.60 return anntowing nter the electricity usage in kilowatt-hours: 75.18

2. PRACTICAL ASSIGNMENT 2 2.1 Covert the following design into C++. Refer to figure 1 for sample output. Save your source file as runProgram1.cpp. Indude your student number, suname and initials and group at the beginning of the source files as comments. Submit anly the C++ source file. DoBlectricityCalcalations custMom <> 99999 display Enter the leotricity usage in kilowatt-hours Call the anntoving Calohntowing (usage) Cali the aub procedure display EnteE the oustoner nusbeE 199999 to end display The total uaage for li customers istotalosage if valusage200 then anntovingval0sage 2.70 DS017AT anntouing 2002.70valUsage-200) 1.60 return anntowing nter the electricity usage in kilowatt-hours: 75.18

Answers

Please find the solution to your problem let me know if you have any concerns.

#include<iostream>
using namespace std;

//declation of methods.
void incrementCounterTotals(float valAmountOwing, float refTotalUsage, int refNumCost);
float calcAmntOwing(float valUsage);

//main class

int main(){
float totalUsage =0;
int numCustomers =0;
cout<<"Enter the customer numer (9999 to end)"<< endl;
int custNum;
cin>>custNum;
do{
cout<<"Enter the eletricity usage in kilowatt- hours" << endl;
float usage;
cin>>usage;
float amntOwing = calcAmntOwing(usage);

incrementCounterTotals(usage,totalUsage,numCustomers);
cout<<"The amount owing for customer "<<custNum<<"is "<<amntOwing<<endl;
cout<<"Enter the customer numer (9999 to end)"<< endl;
cin>>custNum;
}
while (custNum!=9999);
return 0;
}

float calcAmntOwing(float valUsage){
float amntOwing = 0;
if (valUsage <= 200)
amntOwing = valUsage * 2.70;
else
amntOwing = 200 *2.70 + (valUsage - 200) * 1.60;
  
return amntOwing;
}


void incrementCounterTotals(float valAmountOwing, float refTotalUsage, int refNumCost){
refTotalUsage = refTotalUsage + valAmountOwing;
refNumCost = refNumCost + 1;
}

.

Similar Solved Questions

1 answer
Tion 5 continued) c. Anthracene is known to act as the diene in Diels-Alder read as...
tion 5 continued) c. Anthracene is known to act as the diene in Diels-Alder read as maleic anhydride as shown below. Draw the str reaction and draw a reasonable mechanism illustrating its comma explanation for the observed regioselectivity. he diene in Diels-Alder reactions with dienophiles such s s...
1 answer
Question: The U.S. market for automobile is produced by Ford (domestic firm in the US) and...
Question: The U.S. market for automobile is produced by Ford (domestic firm in the US) and Honda (foreign firm in Japan). Suppose that the world consists of only two countries: the U.S. and Japan. The demand curve for automobiles in either country is: Q = 10,000 - P, where Q is the number of cars so...
1 answer
Organic chemistry Part A Draw the Z isomer of an alkene that has a CH3 and...
organic chemistry Part A Draw the Z isomer of an alkene that has a CH3 and an H on one sp carbon and isopropyl and butyl groups on the other sp carbon. Draw the molecule on the canvas by choosing buttons from the Tools (for bonds), Atoms, and Advanced Template toolbars. The single bond is active by ...
1 answer
H 6: In 2004, James Clayton Terry was elected to serve as a member of the...
H 6: In 2004, James Clayton Terry was elected to serve as a member of the Lowndes County, Mississippi, Board of Supervisors, as the supervisor for District Four. As a member of the board, Terry was given a county vehicle and a Fuelman card, to be used for business purposes only. The county later beg...
1 answer
Pitch, P Thrust collar Equal Figure 3 (20%) As shown in Figure 4, a cone clutch...
Pitch, P Thrust collar Equal Figure 3 (20%) As shown in Figure 4, a cone clutch of inclination 10° is to carry 35 kW at 800 rpm. Th width of the lining along an element of the cone is 55 mm. Maximum lining pressure is to be 0 MPa. The coefficient of friction is 0.2. Find suitable values for ro a...
1 answer
8. Ed is single with no dependents. He has receipts for the expenses listed below that...
8. Ed is single with no dependents. He has receipts for the expenses listed below that he paid in 2019. His AGI is $60,000. What are his total itemized deductions for 2019? • $8,000 in unreimbursed medical expenses • 55,400 in state and local income taxes • $6,000 in real estate taxes...
1 answer
Prob. 1 (2 @ 10 per or 20 pts.) An x-ray diffractometer (XRD) scan on a...
Prob. 1 (2 @ 10 per or 20 pts.) An x-ray diffractometer (XRD) scan on a pure Na sample results in a third peak at 20c = 56.559074166030918 deg. Table 1 Characte ristic Wavelength of Common X-Ray Targets Target Fe Ka A 1.93801 1.75661 1.65983 1.50013 1.542471.39221 0.78804 0.70173 Determine the x-ray...
1 answer
ESC ? V AD RO 13. Diagram a diploid cell (2N-4) completing meiosis. On each chromosome...
ESC ? V AD RO 13. Diagram a diploid cell (2N-4) completing meiosis. On each chromosome place two genes, and assume each member of a homologous pair of chromosomes carries a different allele of the two genes tha reside on it. Use letters to denote genes, and upper/lowercase to indicate alleles. 14. I...
1 answer
ELEC324/624 2018 Page 4 i) (2 marks) The open-loop frequency response of the LM748 op-amp is...
ELEC324/624 2018 Page 4 i) (2 marks) The open-loop frequency response of the LM748 op-amp is shown in the figure be for two different values of the external compensating capacitor, Ci.If provides unity-gain compensation, determine the capacitance the op-amp for a closed-loop gain of 3 dB. C-30 pF re...
1 answer
Write a C++ function printArray(A, m, n) that prints an m × n two dimensional array...
Write a C++ function printArray(A, m, n) that prints an m × n two dimensional array A of integers, declared to be “int** A,” to the standard output. Each of the m rows should appear on a separate line....
1 answer
A Moving to another question will save this response. estion 9 Value resources are implemented as...
A Moving to another question will save this response. estion 9 Value resources are implemented as XML files. 5 True False A Moving to another question will save this response....
1 answer
If the pressure is #0.7*atm#, what length of mercury column will this pressure support?
If the pressure is #0.7*atm#, what length of mercury column will this pressure support?...
1 answer
Question 35 1 pts Shift in time domain results in: Convolution in frequency domain Multiplication by...
Question 35 1 pts Shift in time domain results in: Convolution in frequency domain Multiplication by an exponential function in frequency domain None of the above No change in frequency domain...
1 answer
Microbiology Q1 Q2 Q3 Which medium contains a pH indicator to show pH change caused by...
Microbiology Q1 Q2 Q3 Which medium contains a pH indicator to show pH change caused by fermentation? Glucose Broth Lactose Broth SIM Lactose and Glucose Broths Lactose, Glucose, and SIM What is the Gram reaction of Escherichia coli? Positive Negative Gram Neutral It is an acid-fast organism. H...
1 answer
Cusic Music Company is considering the sale of a new sound board used in recording studios....
Cusic Music Company is considering the sale of a new sound board used in recording studios. The new board would sell for $24,600, and the company expects to sell 1,630 per year. The company currently sells 1,980 units of its existing model per year. If the new model is introduced, sales of the exist...
1 answer
Example: Suppose the 8% coupon (semiannual), 30-year maturity bond sells for $1 ,150 and is callable...
Example: Suppose the 8% coupon (semiannual), 30-year maturity bond sells for $1 ,150 and is callable in 10 years at a call price of $1,100. What is its yield to maturit y and yield to call? • Yield to maturity? • Yield to call?...
1 answer
Richard Feynman order-of-magnitude calculation
Nobel laureate Richard Feynman (1918-1988) once said that if two persons stood at arm's length from each other and each person had 1% more electrons than protons, theforce of repulsion between them would be enough to lift a "weight" equal to that of the entire Earth. Carry out an order-o...
1 answer
Pathophysiology of UTI and the pertinent lab work that would determine health of the urologic system.
Pathophysiology of UTI and the pertinent lab work that would determine health of the urologic system....