Question
PROGRAMMING IN C 1.1) Requriements Program must compile with both -Wall and -Werror options enabled Submit only the files requested Use doubles to store real
PROGRAMMING IN C
1.1)
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
Write a program called grade_need.c that calcualtes the minimum percent needed on the final to achieve the desired grade. If the desired grade cannot be achieved because the person cannot score low or high enough on the final to get the desired grade, your program should tell them so.
Grade | Minimum Percent Needed |
A | 90% |
B | 80% |
C | 70% |
D | 60% |
F | 0% |
Requirements
- Your program should be able to accept both lowercase and uppercase letters for the letter grade desired
Assumptions
- Input is NOT guarenteed to be valid
- Some examples of improprer input are
- Incorrectlly formatted input
- Incorrect letter grades desired
- If invalid input is received, your program should report it and terminate
- You'll find the exit function in stdlib.h for doing this. Make sure to only use 0 with exit and no other value.
- Wait until we cover how to handle invalid input in class before dealing with this part of the problem
- Some examples of improprer input are
Examples
Example 1
Enter the grade you want in the class: B Enter your current percent in the class: 75 Enter the weight of the final: 20 You need a grade of at least 100.00% on the final to get a B in the class.
Example 2
Enter the grade you want in the class: b Enter your current percent in the class: 75 Enter the weight of the final: 25 You need a grade of at least 95.00% on the final to get a b in the class.
1.2)
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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started