Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

We are interested in writing a C program that asks the user specic information about a vehicle. The program should then print all the information

We are interested in writing a C program that asks the user specic information about a vehicle. The program should then print all the information and repeat this process until the user indicates the he/she is done entering information. Asking the user at the end whether or not to enter another automobile will be sufcient. The information will be stored in several structures: auto_t and date_t. The structure date_t will contain the month, day, and year (as integers). The structure auto_t will contain the make and model(asstrings),theodometerreading(asanint),thetankcapacityandcurrentfuellevel(asdoubles), and the manufacture and purchase dates (as date_t). Youwillbeaskedtowriteseveralfunctions. scan_date should have a parameter of type date_t and ask the user for the month, day, and year. scan_auto should have a parameter of type auto_t and ask the user to enter the make, model, odometer, tank capacity, and fuel level. It also needs ask for the manufacture and purchase dates by calling scan_date. For simplicity purposes, we will assume that the user enters valid dates. Once all the data has been entered, the program needs to print the information. print_dateshould print the data corresponding to some date_t, and print_auto should print the data corresponding to some auto_t. A sample of the output is given below: Enter the make: Mercury Enter the model: Sable Enter the odometer: 99842 Enter the tank capacity: 16 Enter the fuel level: 12.5 We now need to enter the manufacture date. Enter the month: 5 Enter the day: 30 Enter the year: 1991 We now need to enter the purchase date. Enter the month: 1 Enter the day: 18 Enter the year: 2001 Vehicle Information: Make: Mercury Model: Sable Odometer: 99842 miles Tank Capacity: 16 gallons Fuel Level: 12.5 gallons Manufacture Date: 5/30/1991 Purchase Date: 1/18/2001 Do you want to enter another automobile (y/n)? y Enter the make: Mazda Enter the model: Navajo Enter the odometer: 123961 Enter the tank capacity: 19.3 Enter the fuel level: 16.7 We now need to enter the manufacture date. Enter the month: 2 Enter the day: 20 Enter the year: 1993 We now need to enter the purchase date. Enter the month: 6 Enter the day: 15 Enter the year: 1993 Vehicle Information: Make: Mazda Model: Navajo 5 Odometer: 123961 miles Tank Capacity: 19.3 gallons Fuel Level: 16.7 gallons Manufacture Date: 2/20/1993 Purchase Date: 6/15/1993 Do you want to enter another automobile (y/n)? n Good bye!

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_2

Step: 3

blur-text-image_3

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

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions