[code]PROBLEM #4
In college, each class typically counts as somewhere between 3 and 5 credits.
A student must take at least 12 credits to be considered full time. Otherwise, they are considered part time. This status often affects scholarships. Students are allowed to take a maximum of 1 credits per semester.
At UMCP, resident students (those whose parents live in the same state as the school) pay $360 per credit. If they take so many credits that the calculated total is more than the cap, which is $5,389.50, then they only pay $5,389.50 for the semester.
Nonresident students (those from other states) pay $1387 per credit with a maximum tuition fee capped at $18,445.50 for the semester.
Prompt the user for the student's number of credits and residency status (N or R), and then output that student's status (part or full time) and total tuition owed.
Print appropriate error messages if the input is a negative number or greater than 17. Please ensure that monetary amounts look like money when you print (i.e. format to 2 decimal places).
Example Output:
Number Credits: 6
Resident(R)/Non-Resident(N): R
Student is: Part Time
Tuition is: $2160.00
> Students are allowed to take a maximum of 1 credits per semester.
¿ah? ¿how may you reach the 12 credits then? ¿or how may you ever complete a class that requires you 3 credits?
> resident students pay $360 per credit
> Nonresident students pay $1387 per credit
¿so apart from rent they have to pay credits at 400% the price? ¿what's the logic behind that?
I advise you to use integers for money. If there are any actual cent values in play, use 1 = 1 cent instead of 1 = 1 dollar. If there are not any cents in play, use 1 = 1 dollar and add ".00" where necessary as text on print statements.
If you use a floating point for money, you may get small rounding errors that take some knowledge to avoid.
until you clarify the 1 credit hour max / semester, the question is not really doable.
java is very similar to c++. Much of what you know there translates, but c++ does not require a bogus class when no object is needed, and does not require you to name your files THEIR way, and supports unsigned variables and many more low level things that java threw out to be portable.
python is its own special thing. Its a throwback to the 1950s where your indents affect the code, like they did on punch cards. That alone kills it for me, but its a good language for a hobby programmer that wants to get stuff done without any fuss.
This uses lastchance's calculation from above - which is probably more 'compact' than expected. It relies upon the result of an equality test (==) being either true (value 1) or false (value 0). Anything multiplied by 0 is 0 and adding 0 to anything doesn't change its value.
You'll need to do the formatting as required to 2 decimal places.
No. That's not an input requirement. That is determined by the program based upon the number of credits entered. Re the spec from your first post. For full time the number of credits must be at least 12.