Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Introduction to C Programming for Engineers - Assignment 5 | CSE A205, Assignments of Engineering

Material Type: Assignment; Class: Introduction to C Programming for Engineers; Subject: Computer Systems Engineering ; University: University of Alaska - Anchorage; Term: Fall 2008;

Typology: Assignments

2009/2010

Uploaded on 03/28/2010

koofers-user-9n6-1
koofers-user-9n6-1 ๐Ÿ‡บ๐Ÿ‡ธ

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSE294A Assignment #5
Professor Miller
1/1
CSE294A Assignment #5
1.5% of course grade
This๎˜ƒassignment๎˜ƒwill๎˜ƒgive๎˜ƒyou๎˜ƒthe๎˜ƒchance๎˜ƒto๎˜ƒredeem๎˜ƒsome๎˜ƒof๎˜ƒthe๎˜ƒpoints๎˜ƒlost๎˜ƒon๎˜ƒthe๎˜ƒ
midterm.๎˜ƒ๎˜ƒYou๎˜ƒwill๎˜ƒmerely๎˜ƒcomplete๎˜ƒthe๎˜ƒsecond๎˜ƒpart๎˜ƒof๎˜ƒthe๎˜ƒmidterm๎˜ƒfor๎˜ƒthis๎˜ƒassignment.๎˜ƒ๎˜ƒ
Here๎˜ƒis๎˜ƒthe๎˜ƒdescription.๎˜ƒ
๎˜ƒ
For๎˜ƒthis๎˜ƒprogram,๎˜ƒyou๎˜ƒwill๎˜ƒperform๎˜ƒa๎˜ƒset๎˜ƒof๎˜ƒconversions๎˜ƒfrom๎˜ƒFahrenheit๎˜ƒto๎˜ƒCelsius๎˜ƒor๎˜ƒ
Celsius๎˜ƒto๎˜ƒFahrenheit.๎˜ƒ๎˜ƒThe๎˜ƒuser๎˜ƒwill๎˜ƒfirst๎˜ƒenter๎˜ƒan๎˜ƒF๎˜ƒto๎˜ƒconvert๎˜ƒfrom๎˜ƒFahrenheit๎˜ƒto๎˜ƒCelsius๎˜ƒ
or๎˜ƒa๎˜ƒC๎˜ƒto๎˜ƒconvert๎˜ƒfrom๎˜ƒCelsius๎˜ƒto๎˜ƒFahrenheit.๎˜ƒ๎˜ƒThen๎˜ƒthe๎˜ƒuser๎˜ƒwill๎˜ƒenter๎˜ƒthree๎˜ƒinteger๎˜ƒ
values.๎˜ƒ๎˜ƒThe๎˜ƒfirst๎˜ƒinteger๎˜ƒwill๎˜ƒbe๎˜ƒthe๎˜ƒlower๎˜ƒtemperature.๎˜ƒ๎˜ƒThe๎˜ƒsecond๎˜ƒinteger๎˜ƒwill๎˜ƒbe๎˜ƒthe๎˜ƒ
higher๎˜ƒtemperature.๎˜ƒ๎˜ƒAnd๎˜ƒthe๎˜ƒthird๎˜ƒinteger๎˜ƒwill๎˜ƒbe๎˜ƒthe๎˜ƒincremental๎˜ƒtemperature๎˜ƒchange.๎˜ƒ๎˜ƒ
Your๎˜ƒprogram๎˜ƒwill๎˜ƒthen๎˜ƒconvert๎˜ƒall๎˜ƒof๎˜ƒthe๎˜ƒtemperatures๎˜ƒwithin๎˜ƒthat๎˜ƒrange๎˜ƒbased๎˜ƒon๎˜ƒthe๎˜ƒ
incremental๎˜ƒtemperature๎˜ƒchange.๎˜ƒ๎˜ƒHere๎˜ƒare๎˜ƒa๎˜ƒfew๎˜ƒsample๎˜ƒexecutions.๎˜ƒ
Would you like to convert from Fahrenheit to Celsius (F) or Celsius to Fahrenheit (C)? F
Enter the lower Fahrenheit temperature: 20
Enter the higher Fahrenheit temperature: 40
Enter the incremental temperature change: 2
20F = -6.67C
22F = -5.56C
24F = -4.44C
26F = -3.33C
28F = -2.22C
30F = -1.11C
32F = 0.00C
34F = 1.11C
36F = 2.22C
38F = 3.33C
40F = 4.44C
Would you like to convert from Fahrenheit to Celsius (F) or Celsius to Fahrenheit (C)? C
Enter the lower Celsius temperature: 10
Enter the higher Celsius temperature: 30
Enter the incremental temperature change: 3
10C = 50.00F
13C = 55.40F
16C = 60.80F
19C = 66.20F
22C = 71.60F
25C = 77.00F
28C = 82.40F
You๎˜ƒcan๎˜ƒassume๎˜ƒthat๎˜ƒthe๎˜ƒvalues๎˜ƒentered๎˜ƒwill๎˜ƒbe๎˜ƒof๎˜ƒthe๎˜ƒcorrect๎˜ƒtype๎˜ƒ(a๎˜ƒcharacter๎˜ƒfor๎˜ƒthe๎˜ƒ
type๎˜ƒof๎˜ƒconversion๎˜ƒand๎˜ƒintegers๎˜ƒfor๎˜ƒthe๎˜ƒother๎˜ƒthree๎˜ƒvalues),๎˜ƒbut๎˜ƒyou๎˜ƒcannot๎˜ƒassume๎˜ƒ
anything๎˜ƒabout๎˜ƒthe๎˜ƒvalues,๎˜ƒso๎˜ƒput๎˜ƒthe๎˜ƒappropriate๎˜ƒerror๎˜ƒchecks๎˜ƒinto๎˜ƒyour๎˜ƒcode.๎˜ƒ
Grading Criteria
0.2% Prompting the user correctly for the 4 values
0.2% Ensuring only a C or F is entered and prompting the user again if not
0.2% Ensuring the higher temperature is actually higher than the lower temperature
0.2% Ensuring the incremental temperature change is greater than 0
0.2% Properly converting from Fahrenheit to Celsius
0.2% Properly converting from Celsius to Fahrenheit
0.3% Properly displaying the output based on the incremental change

Partial preview of the text

Download Introduction to C Programming for Engineers - Assignment 5 | CSE A205 and more Assignments Engineering in PDF only on Docsity!

CSE294A Assignment # Professor Miller 1/

CSE294A Assignment # 1.5% of course grade

This assignment will give you the chance to redeem some of the points lost on the midterm. You will merely complete the second part of the midterm for this assignment.

Here is the description.

For this program, you will perform a set of conversions from Fahrenheit to Celsius or

Celsius to Fahrenheit. The user will first enter an F to convert from Fahrenheit to Celsius

or a C to convert from Celsius to Fahrenheit. Then the user will enter three integer values. The first integer will be the lower temperature. The second integer will be the

higher temperature. And the third integer will be the incremental temperature change.

Your program will then convert all of the temperatures within that range based on the incremental temperature change. Here are a few sample executions.

Would you like to convert from Fahrenheit to Celsius (F) or Celsius to Fahrenheit (C)? F Enter the lower Fahrenheit temperature: 20 Enter the higher Fahrenheit temperature: 40 Enter the incremental temperature change: 2 20F = -6.67C 22F = -5.56C 24F = -4.44C 26F = -3.33C 28F = -2.22C 30F = -1.11C 32F = 0.00C 34F = 1.11C 36F = 2.22C 38F = 3.33C 40F = 4.44C

Would you like to convert from Fahrenheit to Celsius (F) or Celsius to Fahrenheit (C)? C Enter the lower Celsius temperature: 10 Enter the higher Celsius temperature: 30 Enter the incremental temperature change: 3 10C = 50.00F 13C = 55.40F 16C = 60.80F 19C = 66.20F 22C = 71.60F 25C = 77.00F 28C = 82.40F

You can assume that the values entered will be of the correct type (a character for the

type of conversion and integers for the other three values), but you cannot assume

anything about the values, so put the appropriate error checks into your code.

Grading Criteria 0.2% Prompting the user correctly for the 4 values 0.2% Ensuring only a C or F is entered and prompting the user again if not 0.2% Ensuring the higher temperature is actually higher than the lower temperature 0.2% Ensuring the incremental temperature change is greater than 0 0.2% Properly converting from Fahrenheit to Celsius 0.2% Properly converting from Celsius to Fahrenheit 0.3% Properly displaying the output based on the incremental change