IDNLearn.com provides a collaborative platform for sharing and gaining knowledge. Get accurate and timely answers to your queries from our extensive network of experienced professionals.
Sagot :
Answer:
here, hope it helps.
Explanation:
#include<iostream>
using namespace std;
int calculate(int N)
{
int rate=0;
for(int count=1;count<N;count++)
{
if(count<=300)
rate=rate+9;
else if(count<=600)
rate=rate+8;
else if(count<=1000)
rate=rate+6;
else
rate=rate+5;
}
return rate;
}
void main()
{
int costumer[20];
int wats[20];
int rates[20];
int i=0;
cout<<"please enter the information for the costomers below 0 to stop"<<endl;
while (costumer[i-1]!= 0)
{
cout<<"please enter the number of the coustomer "<<endl;
cin>>costumer[i];
if(costumer[i]==0)
break;
cout<<"please enter Kilowatt-hours used for the costumer "<<endl;
cin>>wats[i];
i++;
}
for(int j=0;j<i;j++)
rates[j]=calculate(wats[j]);
for(int j=0;j<i;j++)
{
cout<<" Customer Number Kilowatt-hours used charge"<<endl;
cout<<" "<<costumer[j]<<" "<<wats[j]<<" "<<rates[j]<<endl;
}
}
We value your participation in this forum. Keep exploring, asking questions, and sharing your insights with the community. Together, we can find the best solutions. IDNLearn.com is committed to your satisfaction. Thank you for visiting, and see you next time for more helpful answers.