Hi. I am a beginner at C Programming. I'm really in the dark about a lot of stuff in this department, so I thought maybe I could get some help from on here.
I have an assignment I have to do for class, and it's just mind-boggling to my little brain
So, hopefully someone can give me some advice and assistance.
Okay, here's what I have to do:
Objective
The objective of this problem is to develop a Fine Calculator program that will:
Input a driver’s speed as measured by traffic patrol.
Determine if a speeding ticket is to be issued and if so, determine the amount of the fine.
Assume fine amount 0 when there is no speed violation.
Output the fine.
Background
For this lab, make the following assumptions:
The fine for speeding in a 45 MPH zone is $10 for every mile per hour over the speed limit for speeds from 46 to 55 MPH.
It is $15 for every additional mile per hour between 56 and 65 MPH.
It is $20 for every additional mile per hour over 65 MPH.
For example, the fine for driving 57 MPH is $100 for the fast 10 MPH plus $30 for the 2 MPH in excess of 55 MPH, for a total of $130.
Now, I know I need to first have a scan function that will scan for the user's input. And should have an "int" for the speed? I was wondering how I would do this for the if statement...since I need the if statement to say "if it's in between two numbers" would it be like:
if (speed>45 && speed<55); ?
and any ideas on what I could do to make it so it would add 10 dollars for each mile gone over the 45.
Any help would be greatly appreciated.
I just really want to learn how to do this.