Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are tasked with writing a complete C program that provides the functionality described below: You own a set of flats and need to collect

You are tasked with writing a complete C program that provides the functionality described below:

"You own a set of flats and need to collect the rent from your student tenants; their contract says they need to pay rent on the first day of each month, but there is a grace period of x days which is the last digit of your student ID number (read in as a single input by your program). If the rent is paid in one of the days in the range 1 - x (inclusive), then your program displays a Thank you message. Otherwise, your program charges the tenant a late fee that is either 5% of the rent or 30.00 (whichever is greater); it displays a 'late fee' message notifying the tenant accordingly."

If the last digit of your student ID is less than 3, then the program should set the grace period x to be value 5. You should assume that the rent amount is represented by a double value.

Below is an example of running the program with specific input values:

Enter date paid, rent value, last digit of ID: 6 400.00 4 Rent was due by day 4 of the month; your late fee is = 30.00 pounds

Notes:

The program must not use in-built C functions; the exception to this are scanf() and printf().

All conditions in the code must use a conditional operator.

The programs variables must be sensibly named.

The code must include comments that are meaningful, short and clear, to explain all major parts of the program.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

1. Define mass and mediated communication

Answered: 1 week ago