samedi 24 octobre 2020

need to create a code to calculate a final budget

Good morning!

I need to create a program to calculate the budget of a computer. The program has to ask the user for the specifications of the computer he wants, and depending on this the final price will be one or the other.

Specs:

  • Processor: i5 ($500), i7 ($750), i9 ($1200)

  • RAM: 8 GB ($200), 16 GB ($300)

  • Hard disk: 256 GB ($200), 512 GB ($300), 1 TB ($500)

The user will be asked about the type of computer they want, using the numeric options (1, 2 and 3, in the case of the processor; 1 and 2 in the case of memory; 1, 2 and 3, in the case of the disk difficult). The user will choose the options using the keyboard.

I need to do this using just control structures: switch-case, do-while, for, if-else. I can't use vectors, functions or anything else.

I had started by using switch-case but I have realized that I would have to use it a lot and teh code would be very long, since the final price can have 18 possible values (look at the fluxogram I put below!!)

If anyone can give me a tip of how to do it, or help me, I would be very grateful!!!!

fluxogram

Aucun commentaire:

Enregistrer un commentaire