Computers and Technology

Please, using C, not C+ or C++. Time it took Matthew to complete: 40 minutes
Files to submit: conversions. c
Requriements
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
Restrictions
No global variables may be used
Your main function may only declare variables and call other functions
Description
In this program you will be converting measurements from one unit to another.
Temperatures
From Farenheit Celsius Kelvin
Farenheit(F) F (F - 32) * 5/9 (F-32)*5/9+273.15
Celsius(C (C * 9/5) +32 C C + 273.15
Kelvin(K) (K - 273.15) * 9/5 + 32 K -273.15 K
Distances
From Inches Feet Yards Miles
Inches(I) I I / 12 I / 36 I / 63360
Feet(F) F * 12 F F / 3 F / 5280
Yards(Y) Y* 36 Y * 3 Y Y / 1760
Miles(M) M * 63360 M * 5280 M * 1760 M
Requirements
Users should be able to enter both upper and lower case letters for units
Any amount of white space should be allowed inputs
Assumptions
Input is NOT guarenteed 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: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 13:30, AsiaDeas4078
Write lines of verse that rhyme to remember the following information: acid rain is a type of air pollution caused by chemicals in the air.
Answers: 1
image
Computers and Technology, 22.06.2019 19:10, kaiya789
10. when you create a pivottable, you need to specify where to find the data for the pivottable. is it true
Answers: 2
image
Computers and Technology, 23.06.2019 01:50, jumoke26
Create a class named majors that includes an enumeration for the six majors offered by a college as follows: acc, chem, cis, eng, his, phys. display the enumeration values for the user, then prompt the user to enter a major. display the college division in which the major falls. acc and cis are in the business division, chem and phys are in the science division, and eng and his are in the humanities division. save the file as majors. java.
Answers: 2
image
Computers and Technology, 23.06.2019 19:00, Heyitsbrandi
Now you’re on your own. include a short summary of this section with plots in your lab report. write a matlab script file to do steps (a) through (d) below. include a listing of the script file with your report. 1 the soundsc(xx, fs) function requires two arguments: the first one (xx) contains the vector of data to be played, the second argument (fs) is the sampling rate for playing the samples. in addition, soundsc(xx, fs) does automatic scaling and then calls sound(xx, fs) to actually play the signal. mcclellan, schafer, and yoder, dsp first, 2e, isbn 0-13-065562-7. prentice hall, upper saddle river, nj 07458. c 2015 pearson education, inc. 4 mcclellan, schafer and yoder, signal processing first. prentice hall, upper saddle river, new jersey, 2003. c 2003 prentice hall. (a) generate a time vector (tt) to cover a range of t that will exhibit approximately two cycles of the 4000 hz sinusoids defined in the next part, part (b). use a definition for tt similar to part 2.2(d). if we use t to denote the period of the sinusoids, define the starting time of the vector tt to be equal to t , and the ending time as ct . then the two cycles will include t d 0. finally, make sure that you have at least 25 samples per period of the sinusoidal wave. in other words, when you use the colon operator to define the time vector, make the increment small enough to generate 25 samples per period. (b) generate two 4000 hz sinusoids with arbitrary amplitude and time-shift. x1.t / d a1 cos.2
Answers: 1
Do you know the correct answer?
Please, using C, not C+ or C++. Time it took Matthew to complete: 40 minutes
Files to submit:...

Questions in other subjects: