Solved–Homework 2– solution

$30.00 $19.00

Files to submit: conversions.c Time it took Matthew to Complete: 45 mins All programs must compile without warnings when using the -Wall and -Werror options Submit only the files requested Do NOT submit folders or compressed files such as .zip, .rar, .tar, .targz, etc Your program must match the output exactly to receive credit. Make…

You’ll get a: . zip file solution

 

 
Categorys:
Tags:

Description

5/5 – (2 votes)

Files to submit: conversions.c

Time it took Matthew to Complete: 45 mins

  • All programs must compile without warnings when using the -Wall and -Werror options

  • Submit only the files requested

    • Do NOT submit folders or compressed files such as .zip, .rar, .tar, .targz, etc

  • Your program must match the output exactly to receive credit.

    • Make sure that all prompts and output match mine exactly.

    • Easiest way to do this is to copy and paste them

  • All input will be valid unless stated otherwise

  • Print all real numbers to two decimal places unless otherwise stated

  • The examples provided in the prompts do not represent all possible input you can receive.

  • All inputs in the examples in the prompt are underlined

    • You don’t have to make anything underlined it is just there to help you differentiate between what you are supposed to print and what is being given to your program

  • If you have questions please post them on Piazza

Restrictions

  • No global variables are allowed

  • Your main function may only declare variables and call other functions.

Assumptions

  • Input is NOT guaranteed to be valid

Files to submit: grade_need.c

Time it took Matthew to Complete: 15 mins

  • All programs must compile without warnings when using the -Wall and -Werror options

  • Submit only the files requested

    • Do NOT submit folders or compressed files such as .zip, .rar, .tar, .targz, etc

  • Your program must match the output exactly to receive credit.

    • Make sure that all prompts and output match mine exactly.

    • Easiest way to do this is to copy and paste them

  • All input will be valid unless stated otherwise

  • Print all real numbers to two decimal places unless otherwise stated

  • The examples provided in the prompts do not represent all possible input you can receive.

  • All inputs in the examples in the prompt are underlined

    • You don’t have to make anything underlined it is just there to help you differentiate between what you are supposed to print and what is being given to your program

  • If you have questions please post them on Piazza

Restrictions

  • No global variables are allowed

  • Your main function may only declare variables and call other functions.

Assumptions

  • Input is not guaranteed to be valid

Files to submit: quad.c

Time it took Matthew to Complete: 5 mins

  • All programs must compile without warnings when using the -Wall and -Werror options

  • Submit only the files requested

    • Do NOT submit folders or compressed files such as .zip, .rar, .tar, .targz, etc

  • Your program must match the output exactly to receive credit.

    • Make sure that all prompts and output match mine exactly.

    • Easiest way to do this is to copy and paste them

  • All input will be valid unless stated otherwise

  • Print all real numbers to two decimal places unless otherwise stated

  • The examples provided in the prompts do not represent all possible input you can receive.

  • All inputs in the examples in the prompt are underlined

    • You don’t have to make anything underlined it is just there to help you differentiate between what you are supposed to print and what is being given to your program

  • If you have questions please post them on Piazza

Restrictions

  • No global variables are allowed

  • Your main function may only declare variables and call other functions.

For this program you will be converting temperatures and distances from one unit to another.

Temperatures

From

Fahrenheit

Celsius

Kelvin

Fahrenheit(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 their choices

  • Any amount of white space should be allowed between a number and its unit

Hints:

  • This is a large program that you will want to break down into lots of functions to help manage the complexity

  • When doing the conversions you can save yourself a bit of work by always converting your units into a common one and then converting to the desired one.

    • For example when converting temperatures you could always convert the given temperature to Celsius and then from Celsius go to the desired unit

Examples on Next Page.

Examples:

  1. 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

  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: 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

  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: J

Unknown conversion type J chosen. Ending Program.

  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: 10

  1. Invalid formatting. Ending program.

  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: t

Enter the temperature followed by its suffix (F, C, or K): 42 G G is not a valid temperature type. Ending program.

  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): 420 Blaze It

  1. Invalid formatting. Ending program.