0

How can make this program

From zero to 100 - 0.80 pounds per kilowatt 101> 200 - 1.00 pounds per kilowatt 201> 300 - 1.20 pounds per kilowatt 301> 400 - 1.40 pounds per kilowatt 401> 500 - 1.60 pounds per kilowatt 501> 600 - 1.80 pounds per kilowatt 601 and over - 6.35 pounds per kilowatt

7th Jan 2021, 1:29 PM
Rawy Elebaid
Rawy Elebaid - avatar
3 Respostas
+ 4
Rawy Elebaid , before we can help you, you should do theses things: - please rework your question. - do a proper task description. give a clear information what your program should do, and give also samples for input and output data. - then you should do an attempt in coding to solve the task. Please attach your code with the question. thanks!
7th Jan 2021, 3:27 PM
Lothar
Lothar - avatar
+ 3
Rawy Elebaid , thanks for sharing your code. I still struggle understanding your problem. Is the code running? is it creating a wrong result? Do you want to shorten the code?
9th Jan 2021, 10:03 AM
Lothar
Lothar - avatar
0
#include <iostream> using namespace std; double a=780; double points; double b; int main() { if (a > 0 && a <81) {points =a/.8; cout << points;} if(a > 80 && a <181) {b=a-80; points =80/.8+b; cout << points;} if(a > 180 && a <301) {b=a-180; points =80/.8+100+b/1.2; cout << points;} if(a > 300 && a <441) {b=a-300; points =80/.8+100+120/1.2+ b/1.4; cout << points;} if(a > 440 && a <601) {b=a-440; points =80/.8+100+120/1.2+ 140/1.4 + b/1.6; cout << points;} if(a > 600 && a <781) {b=a-600; points =80/.8+100+120/1.2+ 140/1.4 + 160/1.6 + b/1.8; cout << points;} if(a > 780) {b=a-780; points =80/.8+100+120/1.2+ 140/1.4 + 160/1.6 + 180/1.8+b/6.35; cout << points;} return 0; }
8th Jan 2021, 12:15 PM
Rawy Elebaid
Rawy Elebaid - avatar