include #include #include using namespace std; int main() { string Jan,F,Ma,Ap,May,Ju,Jul,Au,S,O,N,D; int i; double sum,sum1; double B; cout << "please input monthly usage in kWh for January: " << endl; cin >> Jan;

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

#include <iostream>
#include <string>
#include<iomanip>
using namespace std;
int main()
{
string Jan,F,Ma,Ap,May,Ju,Jul,Au,S,O,N,D;
int i;
double sum,sum1;
double B;
cout << "please input monthly usage in kWh for January: " << endl;
cin >> Jan;
cout << "please input monthly usage in kWh for February: " << endl;
cin >> F;
cout << "please input monthly usage in kWh for March: " << endl;
cin >> Ma;
cout << "please input monthly usage in kWh for April: " << endl;
cin >> Ap;
cout << "please input monthly usage in kWh for May: " << endl;
cin >> May;
cout << "please input monthly usage in kWh for June: " << endl;
cin >> Ju;
cout << "please input monthly usage in kWh for July: " << endl;
cin >> Jul;
cout << "please input monthly usage in kWh for August: " << endl;
cin >> Au;
cout << "please input monthly usage in kWh for September: " << endl;
cin >> S;
cout << "please input monthly usage in kWh for October: " << endl;
cin >> O;
cout << "please input monthly usage in kWh for November: " << endl;
cin >> N;
cout << "please input monthly usage in kWh for December: " << endl;
cin >> D;
string month[12] ={" January "," February "," March "," April "," May "," June "," July ","August "," September "," October "," November ","
December ",};
//- For consumption of less than or equal to RM600 per month, a 10% discount is given.
//- For consumption of more than RM600 per month, a 6% service tax is imposed.
{
for(i=1;i<=100;i++)
{
i*(17.5)==sum;
sum*(10/100)==sum1;
sum-sum1==B;
}
for(i=101;i<=200;i++)
{
i*(18.5)==sum;
sum*(10/100)==sum1;
sum-sum1==B;
}
for(i=201;i<=300;i++)
{
i*(33.0)==sum;
sum*(10/100)==sum1;
sum-sum1==B;
}
for(i=301;i<=500;i++)
{
i*(44.5)==sum;
sum*(10/100)==sum1;
sum-sum1==B;
}
for(i=501;i<=1000;i++)
{
i*(45.0)==sum;
sum*(10/100)==sum1;
sum-sum1==B;
}
for(i=1001;i>1001;i++)
{
i*(47.0)==sum;
sum*(10/100)==sum1;
sum-sum1==B;
}
cout << "Your bill for " << month[0] << " is " << B << endl;
cout << "Your bill for " << month[1] << " is " << B << endl;
cout << "Your bill for " << month[2] << " is " << B << endl;
cout << "Your bill for " << month[3] << " is " << B << endl;
cout << "Your bill for " << month[4] << " is " << B << endl;
cout << "Your bill for " << month[5] << " is " << B << endl;
cout << "Your bill for " << month[6] << " is " << B << endl;
cout << "Your bill for " << month[7] << " is " << B << endl;
cout << "Your bill for " << month[8] << " is " << B << endl;
cout << "Your bill for " << month[9] << " is " << B << endl;
cout << "Your bill for " << month[10] << " is " << B << endl;
cout << "Your bill for " << month[11] << " is " << B << endl;
}
return 0;
}

 

 

Tell me which part of the program has the problems and modify the problem to get the correct output according to the question shown in the picture

The domestic tariff charged by Sabah Electricity Sdn Bhd (SESB) is given in Table 1. Based on the tariff, write
a C++ program that can do the following:
a. Tell the user to input the monthly usage (in kWh) from January to December.
b. Calculate the consumption, discount, tax, and bill in RM for each month.
- For consumption of less than or equal to RM600 per month, a 10% discount is given.
For consumption of more than RM600 per month, a 6% service tax is imposed.
c. Display the output as depicted in Figure 1. Format the values to two decimal points.
Table 1
Tariff Category
Unit
Rates
For the first 100 (1-100kWh) per month
Sen/kWh
17.5
For the next 100 (101-200kWh) per month
Sen/kWh
18.5
For the next 100 (201-300kWh) per month
Sen/kWh
33.0
For the next 200 (301-500kWh) per month
For the next 500 (501-1000kWh) per month
Sen/kWh
44.5
Sen/kWh
45.0
For the next kWh (1001kWh onwards) per month
Sen/kWh
47.0
Month
Usage(kWh)
Consumption(RM)
10% Discount(RM)
6% Tax(RM)
Bill(RM)
Jan
100
17.50
1.75
0.00
15.75
Feb
200
36.00
3.60
0.00
32.40
March
300
69.00
6.90
0.00
62.10
April
2000
849.00
0.00
50.94
899.94
May
Dec
Figure 1
Transcribed Image Text:The domestic tariff charged by Sabah Electricity Sdn Bhd (SESB) is given in Table 1. Based on the tariff, write a C++ program that can do the following: a. Tell the user to input the monthly usage (in kWh) from January to December. b. Calculate the consumption, discount, tax, and bill in RM for each month. - For consumption of less than or equal to RM600 per month, a 10% discount is given. For consumption of more than RM600 per month, a 6% service tax is imposed. c. Display the output as depicted in Figure 1. Format the values to two decimal points. Table 1 Tariff Category Unit Rates For the first 100 (1-100kWh) per month Sen/kWh 17.5 For the next 100 (101-200kWh) per month Sen/kWh 18.5 For the next 100 (201-300kWh) per month Sen/kWh 33.0 For the next 200 (301-500kWh) per month For the next 500 (501-1000kWh) per month Sen/kWh 44.5 Sen/kWh 45.0 For the next kWh (1001kWh onwards) per month Sen/kWh 47.0 Month Usage(kWh) Consumption(RM) 10% Discount(RM) 6% Tax(RM) Bill(RM) Jan 100 17.50 1.75 0.00 15.75 Feb 200 36.00 3.60 0.00 32.40 March 300 69.00 6.90 0.00 62.10 April 2000 849.00 0.00 50.94 899.94 May Dec Figure 1
Expert Solution
steps

Step by step

Solved in 3 steps with 5 images

Blurred answer
Knowledge Booster
Variables
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education