Computers and Technology

Program in C: In this program you will be converting measurements from one unit to another.

Restrictions

No global variables may be used
Your main function may only declare variables and call other functions
Temperatures

FromFarenheitCelsiusKelvin
Farenheit(F)F(F - 32) * 5/9(F-32)*5/9+273.15
Celsius(C(C * 9/5) +32CC + 273.15
Kelvin(K)(K - 273.15) * 9/5 + 32K -273.15K
Distances

FromInchesFeetYardsMiles
Inches(I)II / 12I / 36I / 63360
Feet(F)F * 12FF / 3F / 5280
Yards(Y)Y* 36Y * 3YY / 1760
Miles(M)M * 63360M * 5280M * 1760M
Requirements

Users should be able to enter both upper and lower case letters for units
Any amount of white space should be allowed inputs
The program must compile with both -Wall and -Werror options enabled
Submit only the files requested
Use doubles to store real numbers
Print all doubles to 2 decimal points unless stated otherwise
Assumptions

Input is NOT guaranteed to be valid
If invalid input is received, your program should report it and terminate
Wait until we cover how to handle invalid input in class before dealing with this part of the problem
Tips

This problem is very large and you will want to break it down into many functions to help manage complexity
When reading in a character don't forget to put a space in front of the %c in scanf
You can save yourself a bit of work by always converting to a common unit and then converting to the desired unit
For example, always converting yards first and then from yards to the desired unit
The exit function in stdlib. h can be very helpful for ending a program early. If you use it make sure to do exit(0)
Examples

Example 1

Pick the type of conversion that you would like to do.
T or t for temperature
D or d for distance
Enter your choice: t
Enter the temperature followed by its suffix (F, C, or K): 0K
Enter the new unit type (F, C, or K): C
0.00K is -273.15C

Example 2

Pick the type of conversion that you would like to do.
T or t for temperature
D or d for distance
Enter your choice: d
Enter the distance followed by its suffix (I, F,Y, M): 5 y
Enter the new unit type (I, F,Y, M): i
5.00Y is 180.00I

Example 3

Pick the type of conversion that you would like to do.
T or t for temperature
D or d for distance
Enter your choice: J
Unknown conversion type J chosen. Ending program.

Example 4

Pick the type of conversion that you would like to do.
T or t for temperature
D or d for distance
Enter your choice: 10
Invalid formatting. Ending program.

Example 5

Pick the type of conversion that you would like to do.
T or t for temperature
D or d for distance
Enter your choice: t
Enter the temperature followed by its suffix (F, C, or K): 42 G
G is not a valid temperature type. Ending program.

Example 6

Pick the type of conversion that you would like to do.
T or t for temperature
D or d for distance
Enter your choice: t
Enter the temperature followed by its suffix (F, C, or K): 420 Blaze It
Invalid formatting. Ending program.

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 12:10, drelisech6467
Linux is distributed under gnu gpl. why is this important? a. it ensures that only torvalds can profit from the sale of linux b. it prevents unknowledgeable users from downloading programs they don't know how to operate. c. it provides protection for the developers who created linux. d. it states that anyone can copy, modify, and share the program if changes are made public.
Answers: 1
image
Computers and Technology, 22.06.2019 15:30, coollid876
To increase sales, robert sends out a newsletter to his customers each month, letting them know about new products and ways in which to use them. in order to protect his customers' privacy, he uses this field when addressing his e-mail. attach bcc forward to
Answers: 2
image
Computers and Technology, 23.06.2019 11:00, la200564
How should you specify box sizes on a web page if you want the boxes to vary according to the font size of the text they contain? a. in pixels b. in inches c. as percentages d. in em units
Answers: 2
image
Computers and Technology, 23.06.2019 18:00, sophx
Apunishment or the threat of punishment used to enforce conformity. select the best answer from the choices provided t f
Answers: 1
Do you know the correct answer?
Program in C: In this program you will be converting measurements from one unit to another.
<...

Questions in other subjects:

Konu
History, 10.03.2021 22:00
Konu
History, 10.03.2021 22:00
Konu
Mathematics, 10.03.2021 22:00
Konu
Mathematics, 10.03.2021 22:00
Konu
Mathematics, 10.03.2021 22:00
Konu
Mathematics, 10.03.2021 22:00