Simple C Programming Assignment

I’m working on a Computer Science exercise and need support.

Complete the attached c programming exercise. Use the following code to test your code:

# Compare the results from your program with the expected results on the test cases.

echo ‘====================================================’

#

./a.out <<-EndOfInput

0

EndOfInput

echo ‘—————————————————-‘

echo ‘Expected:’

echo ‘Please select from the following menu: 1. Flatbed pickup truck I. 2. Flatbed pickup truck 2,’

echo ‘3. Cargo van. 4. Moving box truck.’

echo ‘Enter truck selection: 0’

echo ‘Invalid input. The input should be in the range of 1 to 4.’

echo ‘====================================================’

./a.out <<-EndOfInput

5

EndOfInput

echo ‘—————————————————-‘

echo ‘Expected:’

echo ‘Please select from the following menu: 1. Flatbed pickup truck I. 2. Flatbed pickup truck 2,’

echo ‘3. Cargo van. 4. Moving box truck.’

echo ‘Enter truck selection: 5’

echo ‘Invalid input. The input should be in the range of 1 to 4.’

echo ‘====================================================’

./a.out <<-EndOfInput

1 6 20

EndOfInput

echo ‘—————————————————-‘

echo ‘Expected:’

echo ‘Please select from the following menu: 1. Flatbed pickup truck I. 2. Flatbed pickup truck 2,’

echo ‘3. Cargo van. 4. Moving box truck.’

echo ‘Enter truck selection: 1’

echo ‘Enter hours rented: 6’

echo ‘Enter minutes rented: 20’

echo ‘Amount due ($): 49’

echo ‘====================================================’

./a.out <<-EndOfInput

2 3 23

EndOfInput

echo ‘—————————————————-‘

echo ‘Expected:’

echo ‘Please select from the following menu: 1. Flatbed pickup truck I. 2. Flatbed pickup truck 2,’

echo ‘3. Cargo van. 4. Moving box truck.’

echo ‘Enter truck selection: 2’

echo ‘Enter hours rented: 3’

echo ‘Enter minutes rented: 23’

echo ‘Amount due ($): 64’

echo ‘====================================================’

./a.out <<-EndOfInput

3 16 40

EndOfInput

echo ‘—————————————————-‘

echo ‘Expected:’

echo ‘Please select from the following menu: 1. Flatbed pickup truck I. 2. Flatbed pickup truck 2,’

echo ‘3. Cargo van. 4. Moving box truck.’

echo ‘Enter truck selection: 3’

echo ‘Enter hours rented: 16’

echo ‘Enter minutes rented: 40’

echo ‘Amount due ($): 89’

echo ‘====================================================’

./a.out <<-EndOfInput

4 1 5

EndOfInput

echo ‘—————————————————-‘

echo ‘Expected:’

echo ‘Please select from the following menu: 1. Flatbed pickup truck I. 2. Flatbed pickup truck 2,’

echo ‘3. Cargo van. 4. Moving box truck.’

echo ‘Enter truck selection: 4’

echo ‘Enter hours rented: 1’

echo ‘Enter minutes rented: 5’

echo ‘Amount due ($): 29’

echo ‘====================================================’

Get 20% discount on your first order with us. Place an order and use coupon: GET20

Posted in Uncategorized