Computers and Technology
Computers and Technology, 29.10.2020 07:20, jaueuxsn

C++ Write a program that first asks the user which Temperature scale conversion he/she would like to perform: 1. Convert F to C
2. Convert C to F
3. Quit

What is your choice?

Then it asks the user for input for three real number variables: start_temp, end_temp, temp_incr. It will then produce a two column Fahrenheit to Celsius table or a two column Celsius to Fahrenheit table, depending on the choice.
For choice 1, the first column should be labeled Fahrenheit and the first value the Fahrenheit column is start_temp. The second column should be labeled Celsius, and its value is calculated from the values in the Fahrenheit column using the formula
C = (5.0/9.0)*(F – 32.0).
For choice 2, the table will show the Celsius column first, Fahrenheit column second, and use the formula
F = 9.0/5.0 * C + 32.0

The values for the temps in the first column will be incremented by temp_incr, and end when the table value would exceed the end_temp value. Display all values with 2 decimal of accuracy, justified and aligned.
Requirements:

1) A detailed algorithm
2) Verify all numeric data are acceptable and not character
3) Follow all good programming practices such as descriptive variable names, constants names, proper indentation,...
4) Verify input for correct range and type ( not character)
5) Output should be the same as the sample shown below, I used 30 β€˜β€“β€˜ for the underlining of heading.
Sample Output

Output Sample:

Choose a conversion type:
1. Convert F to C
2. Convert C to F
3. Quit

What is your choice? 1

Enter starting value: 29
Enter ending value: 32
Enter increment value: 0.5

Fahrenheit Celsius
29.00 -1.67
29.50 -1.39
30.00 -1.11
30.50 -0.83
31.00 -0.56
31.50 -0.28
32.00 0.00
Choose a conversion type:
1. Convert F to C
2. Convert C to F
3. Quit

What is your choice? 4

Invalid choice. Try again.
Choose a conversion type:
1. Convert F to C
2. Convert C to F
3. Quit

What is your choice? 2

Enter starting value: 35
Enter ending value: 32
Enter increment value: -1

Celsius Fahrenheit
35.00 95.00
34.00 93.20
33.00 91.40
32.00 89.60
Choose a conversion type:
1. Convert F to C
2. Convert C to F
3. Quit

What is your choice? 2

Enter starting value (integer number): 35
Enter ending value (integer number): 32
Enter increment value (real number): 1

Invalid range. Try again.
Choose a conversion type:
1. Convert F to C
2. Convert C to F
3. Quit

What is your choice? 3

Thank you for your using my program. Program terminated.

THIS IS MY CODE:
#include
#include
using namespace std;

const int CWIDTH = 26;

int main() {

int choice;
double convertFoC, converCtoF;
double starting, endvalue, incrementvalue;
const int CWIDTH = 13;

cin >> choice;

switch (choice)
{
case 4:
cout > starting;
if (starting == 28){
cout > endvalue;

cin >> incrementvalue;

switch (choice) {

case 1:
cout << "Fahrenheit" << setw(17) << "Celsius" << endl;
for (double calcCelsius = starting; calcCelsius <= endvalue; calcCelsius = calcCelsius + incrementvalue)
{
convertFoC = (5.0 / 9.0) * (calcCelsius - 32.0);
cout << showpoint << fixed << setprecision(2) << calcCelsius << setprecision(2) << setw(21) << convertFoC << right;
cout << endl;
}
break;

case 2:
cout << "Celsius" << setw(CWIDTH) << "Fahrenheit\n";
for (double calcFahrenheit = starting; calcFahrenheit <= endvalue; calcFahrenheit = calcFahrenheit + incrementvalue)
{
converCtoF = ((9.0 / 5.0) * calcFahrenheit) + 32.0;
cout << setw(CWIDTH) << showpoint << fixed << setprecision(1) << calcFahrenheit << fixed << setprecision(1) << setw(CWIDTH) << converCtoF << right;
cout << endl;
}

}

}

This is my code but i have a lot of test that i can't get into it.
like the screenshoots that i post here.


C++ Write a program that first asks the user which Temperature scale conversion he/she would like t
C++ Write a program that first asks the user which Temperature scale conversion he/she would like t
C++ Write a program that first asks the user which Temperature scale conversion he/she would like t
C++ Write a program that first asks the user which Temperature scale conversion he/she would like t

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 19:30, ansley81
Assignment directions the owner of a popular local coffee shop has approached you to design a network for his business. he would like to offer his customers wifi access to the internet, but also thinks it might be handy to network the kitchen and store room together with the office computer he already uses for ordering, scheduling, and payroll. he thinks that might save him time doing inventory control and ordering. your assignment is to create a set of questions for him that will precisely define the purpose of the network and any constraints and restrictions on its implementation. assignment guidelines create a list of at least ten questions to ask your customer. of those ten questions, at least one question must come from each of the following subject areas: purpose of the network network access and security issue network availability and fault tolerance issues future expansion issues vendor issues briefly explain in two or three sentences why you would ask each question and what you expect to learn from your customer’s response. submission requirements your questions should meet the criteria of a good survey question by being specific, unambiguous, and closed-ended. all questions, as well as your explanations, should be written in proper english using correct grammar, spelling, and punctuation. use complete sentences, and do not use slang, texting abbreviations, or shortcuts.
Answers: 3
image
Computers and Technology, 22.06.2019 21:30, sunshinekisses
After you clean an engine with hot water spray, it seems to stall; when it doesn't stall, it's idling noisily. technician a says to check for loose bolts on the flex plate near the torque converter. technician b says to wipe down the spark plug wires and the distributor cap. who is correct? a. technician a b. both technicians a and b c. technician b
Answers: 1
image
Computers and Technology, 23.06.2019 03:00, jarteria0
State 7 common key's for every keyboard
Answers: 1
image
Computers and Technology, 23.06.2019 21:30, maddietomlinson113
Examine the list below. which factors positively affect lifetime income? check all that apply.
Answers: 1
Do you know the correct answer?
C++ Write a program that first asks the user which Temperature scale conversion he/she would like to...

Questions in other subjects:

Konu
Mathematics, 14.11.2019 04:31