Starting from:

$30

Project #3 Modify project 1

Project #3
Task #1 - Modify project 1 (50 points)
Task
Modify your project 1 solu!on to use arrays to represent 4-hour, per day, and per week rates
for the four equipments, and update the calcula!on using the arrays. The program should have
one calcula!on for all equipments. All other requirements are the same.
h"ps://usflearn.instructure.com/courses/1829998/assignments/14363017
If you have already done the above in your project 1 submission, you can submit the same
program for this task.
Submission instruc!ons
1. Develop and test your program on the student cluster
1. To compile your program, run: gcc -std=c99 -Wall your_program.c
2. To execute your program, run: ./a.out
2. Name your program project1_rental.c
1. To rename your program, run: mv your_program.c project3_rental.c
3. Test your program with the shell script on Unix: try_project3_rental
1. upload the script zip file to the student cluster in the same directory as your program.
2. run: $ unzip try_project3_rental.zip
3. move your program to the same folder as try_project1_rental file
4. run: chmod +x try_project3_rental
5. run: ./try_project3_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.
Task #2 (50 points)
Task
To save energy, the owner of a local shopping mall installed a sensor that verifies when there is
someone on the escalator. When the sensor detects no presence, the escalator is deac!vated,
this way saving energy un!l the next person arrives. Write a program that calculates the
number of ac!ve seconds that an escalator was ac!ve. The escalator is ini!ally inac!ve. The
amount of !me that a person takes to go from the beginning to the end of the escalator is 10
seconds. The input are the number of people, and the arrival !mes of each person at the
escalator.
In example #1 below, 2 people used the escalator, first person arrived at 12 second, and
second person arrived at 25 second. The escalator is ac!ve for 20 seconds, 12 to 22 , and
25 to 35 seconds.
In example #2 below, 3 people used the escalator, first person arrived at 12 second, and
second person arrived at 15 second, and the third person arrived at 20 second. The
escalator is ac!ve for 18 seconds, 12 to 30 seconds.
Requirements
1. Follow the format of the examples below.
2. The program should include the following func!on:
 int ac!ve_seconds(int arrival[], int n)
The func!on calcuates the total number of ac!ve seconds. Array arrival[] represents the
arrival !me of each person, n is the length of array arrival, represen!ng the number of
people.
3. In the main func!on, call the ac!ve_seconds func!on and display the result.
Examples (your program must follow this format precisely)
Example #1
Enter number of people: 2
Enter arrival times: 12 25
Active seconds: 20
Example #2
Enter number of people: 3
Enter arrival times: 12 15 20
Active seconds: 18
Example #3
Enter number of people: 5
Enter arrival times: 12 15 20 34 41
Active seconds: 35
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 project3_escalator.c
A. To rename your program, run: $ mv your_program.c project3_escalator.c
3. Test your program with the shell script on Unix: try_project3_escalator
A. Upload the script to the same directory as your program.
B. Run: $ chmod +x try_project3_escalator
C. Run: $ ./try_project3_escalator
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.
General instruc!ons
Grading
Task #1
Total points: 50
A program that does not compile will result in a zero.
Run!me error and compila!on warning 3 points
1 points off, if a warning is present.
3 points off, if mul!ple warnings are present.
Commen!ng and style 8 points
 1 point off for not pu%ng name and descrip!on at the beginning
 2 to 4 points off if the code didn't have clarifying comments.
 1 to 3 points off (depending on how much indenta!on is off) if the program is not indented
properly.
Func!onality
 3 points off for each incorrect test case
 5 points off if array is not used to represent 4-hour, per day, or per week rates
 10 points off if array are not used in the calcula!on of cost
Task #2
Total points: 50
A program that does not compile will result in a zero.
Run!me error and compila!on warning 3 points
1 points off, if a warning is present.
3 points off, if mul!ple warnings are present.
Commen!ng and style 8 points
1 point off for not pu%ng name and descrip!on at the beginning
2 to 4 points off if the code didn't have clarifying comments.
1 to 3 points off (depending on how much indenta!on is off) if the program is not indented
properly.
Func!onality
 8 points off for each incorrect test case
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