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;
#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
Step by step
Solved in 3 steps with 5 images