Starting from:

$30

Project #1 Floor cleaning equipment rental

Project #1

Task
A friend wants to start a small business for floor cleaning equipment rental, similar to what
Home Depot offers (h"ps://www.homedepot.com/c/floor_cleaning_equipment_rental).
Its rental pricing is offered with 4-hours, per day, and per week op#ons.
A rental of any number of hours less than 4-hours will be charged with the 4-hour rate. A rental
of any period of less than a day will be capped (maximum charge) with the per day rate. For
example, 8-hours rental of carpet blower will cost $10. A rental of any period of less than a
week will be capped (maximum charge) with the per week rate.
Write a program that calculates and prints the charges for a floor cleaning equipment rental.
The user should enter the selec#on, enter the days and hours rented for a customer, and print
the charge.
Equipment 4-hours Per day Per week
1 Carpet blower $7 $10 $40
2 Carpet cleaner $27 $39 $156
3
Carpet
extractor with
heater
$61 $87 $348
4 Hard flooring
cleaner $59 $84 $336
Requirements
1. The user enters the equipment selec#on, enter the number of days, and number of hours.
The program calculates and prints the charge. Follow the format of the examples below.
2. Your program should validate the equipment selec#on. If the selec#on is not in the range of
1 to 4, print the message "Invalid selec!on. Select from 1 to 4." and exit the program.
3. Your program should validate hours (>=0 and <24 hours). If the selec#on is not in the range,
print the message "Invalid hours." and exit the program.
4. Hint: use / and % operators might be useful in the calcula#ons
Examples (your program must follow this format precisely)
Example #1:
Please select from four equipment: 1, 2, 3, and 4
Enter equipment selec#on: 6
Invalid selec#on. Select from 1 to 4.
Example #2:
Please select from four equipment: 1, 2, 3, and 4
Enter equipment selec#on: 3
Enter days: 0
Enter hours: 30
Invalid hours.
Example #3:
Please select from four equipment: 1, 2, 3, and 4
Enter equipment selec#on: 1
Enter days: 1
Enter hours: 7
Charge($): 20
Example #4:
Please select from four equipment: 1, 2, 3, and 4
Enter equipment selec#on: 2
Enter days: 10
Enter hours: 4
Charge($): 300
Example #5:
Please select from four equipment: 1, 2, 3, and 4
Enter equipment selec#on: 3
Enter days: 26
Enter hours: 8
Charge($): 1392
Submission instruc!ons
1. Develop and test your program on the student cluster
A. To compile your program, run: gcc -std=c99 -Wall your_program.c
B. To execute your program, run: ./a.out
2. Name your program project1_rental.c
A. To rename your program, run: mv your_program.c project1_rental.c
3. Test your program with the shell script on Unix: try_project1_rental
A. upload the script zip file to the student cluster in the same directory as your program.
B. run: $ unzip try_project1_rental.zip
C. move your program to the same folder as try_project1_rental file
D. run: chmod +x try_project1_rental
E. run: ./try_project1_rental
4. Download the program from student cluster and submit it on Canvas->Gradescope. Make
sure you submit a file with the correct name!
5. You can submit your program as many #mes as needed before the due date. Gradescope
will indicate the test cases with incorrect output, if any exists.
6. Please note that GradeScope is used for tes#ng some of the func#onali#es. It’s part of the
grading process. The grade you received on GradeScope only reflects the results of your
program against the test cases, it is not your final project grade. Projects will be manually
graded a$er running the test cases on GradeScope.
Grading
Total points: 100
A program that does not compile will result in a zero.
Run#me error and compila#on warning 5%
3 points off, if a warning is present.
5 points off, if mul#ple warnings are present.
Commen#ng and style 15%
2 points off for not pu%ng name and descrip#on at the beginning
3 to 8 points off if the code didn't have clarifying comments.
 1 to 5 points off (depending on how much indenta#on is off) if the program is not
indented properly.
Func#onality 80%
 For project 1, if all test cases were passed, full credit for func#onality.
test case 1 is incorrect – 5 points off
test case 2 is incorrect - 5 points off
test case 3 is incorrect – 10 points off
test case 4 is incorrect – 10 points off
test case 5 is incorrect – 10 points off
test case 6 is incorrect – 10 points off
test case 7 is incorrect – 10 points off
Programming Style Guidelines
The major purpose of programming style guidelines is to make programs easy to read and
understand. Good programming style helps make it possible for a person knowledgeable in the
applica#on area to quickly read a program and understand how it works.
Your program should begin with a comment that briefly summarizes what it does. This
comment should also include your name.
In most cases, a func#on should have a brief comment above its defini#on describing what
it does. Other than that, comments should be wri"en only needed in order for a reader to
understand what is happening.
Variable names and func#on names should be sufficiently descrip#ve that a knowledgeable
reader can easily understand what the variable means and what the func#on does. If this is
not possible, comments should be added to make the meaning clear.
Use consistent indenta#on to emphasize block structure.
Full line comments inside func#on bodies should conform to the indenta#on of the code
where they appear.
Macro defini#ons (#define) should be used for defining symbolic names for numeric
constants. For example: #define PI 3.141592
Use names of moderate length for variables. Most names should be between 2 and 12
le"ers long.
Use underscores to make compound names easier to read: tot_vol and total_volumn are
clearer than totalvolumn. 

More products