Task 1/2: Car dealership This task will be a car dealership where you'll help the user find the car(s) they want. This program should keep going until the user either decides to not continue with the purchase, or the purchase is complete, and no more order is being processed. You will need 3 structs to store: • client information • order information used car information Each struct would have the following fields: struct used_car { }; int carID; char brand [length]; char make [length]; }; int year; int mileage; float price; struct order { int numCosigned; int carID; float pricePerterson; struct client { char firstName [length]; char lastName [length]; bool is Employed; int creditScore; }; I. global variables: • • Make sure to put the struct definition above the array creation, otherwise, it won't work. o This is similar to you trying to call a function X that's not declared above of main or any other function that calls X. Create an array of struct used car and add some cars in there. I put 4 cars. You can do as many as you want (at least 3). II. main():

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

Please use C as the programing language. 

Task 1/2: Car dealership
This task will be a car dealership where you'll help the user find the car(s) they want. This
program should keep going until the user either decides to not continue with the purchase, or the
purchase is complete, and no more order is being processed.
You will need 3 structs to store:
• client information
•
order information
used car information
Each struct would have the following fields:
struct used_car
{
};
int carID;
char brand [length];
char make [length];
int year;
int mileage;
float price;
struct order
{
};
int numCosigned;
int carID;
float pricePerterson;
struct client
{
char firstName [length];
char lastName [length];
bool is Employed;
int creditScore;
};
I. global variables:
•
•
Make sure to put the struct definition above the array creation, otherwise, it won't work.
o This is similar to you trying to call a function X that's not declared above of main
or any other function that calls X.
Create an array of struct used car and add some cars in there. I put 4 cars. You can do as
many as you want (at least 3).
II. main():
Transcribed Image Text:Task 1/2: Car dealership This task will be a car dealership where you'll help the user find the car(s) they want. This program should keep going until the user either decides to not continue with the purchase, or the purchase is complete, and no more order is being processed. You will need 3 structs to store: • client information • order information used car information Each struct would have the following fields: struct used_car { }; int carID; char brand [length]; char make [length]; int year; int mileage; float price; struct order { }; int numCosigned; int carID; float pricePerterson; struct client { char firstName [length]; char lastName [length]; bool is Employed; int creditScore; }; I. global variables: • • Make sure to put the struct definition above the array creation, otherwise, it won't work. o This is similar to you trying to call a function X that's not declared above of main or any other function that calls X. Create an array of struct used car and add some cars in there. I put 4 cars. You can do as many as you want (at least 3). II. main():
• Print a welcome message.
•
Call a function that utilize all the cars available (from array created above) and print
them, so the client knows what options they have.
•
Ask them to choose the which car they want. They can input their answer based on the
carID field from available_car struct.
o
Make sure to check for invalid answers. Ask for reinput until it's valid.
o I made my ID from 1->N.
You can tell them to input 0 if they don't want to buy anything.
If this is the case, write some message and quit the program.
• Ask the user if they will be the sole owner or will they cosign and save that info into
order structure.
●
o We assume that if there are 2 co-signers, each will pay 50%, 3 co-signers would
be 33.33% each, and so on...
Print the price for the car that they have chosen, calculate how much EACH cosigner has
to pay, and ask them if you are okay with this price and would like to process
If they answer No, write some message and quit the program.
o
o If they answer Yes,
▪
call another function to get the co-signers information (struct client)
when done getting the info, call another function to print back all the
clients information
▪
you can also print the price per person in the end when printing out each
person's cost. It's up to you.
III. other functions (it' up to you to have more functions, I'm giving the 3 required
functions. Doesn't have to be exactly the same. This is a guide.):
▪ printCars() function:
o prints all the used cars the dealership have from the global array.
getClientInfo() function (or whatever you want to call it):
o take an order struct
o create an array of struct client.
o loop through each client and get their information (name, creditScore,...) and
save the info in the struct client array.
o call printClientInfo() function to print back the information after.
(You should not print the information right after the scanning the information, it should
be done at the end and all the passengers info are printed together).
▪ printClientInfo() function (or whatever you want to call it):
o take an array of struct client
o loop through each client and print out their information
Transcribed Image Text:• Print a welcome message. • Call a function that utilize all the cars available (from array created above) and print them, so the client knows what options they have. • Ask them to choose the which car they want. They can input their answer based on the carID field from available_car struct. o Make sure to check for invalid answers. Ask for reinput until it's valid. o I made my ID from 1->N. You can tell them to input 0 if they don't want to buy anything. If this is the case, write some message and quit the program. • Ask the user if they will be the sole owner or will they cosign and save that info into order structure. ● o We assume that if there are 2 co-signers, each will pay 50%, 3 co-signers would be 33.33% each, and so on... Print the price for the car that they have chosen, calculate how much EACH cosigner has to pay, and ask them if you are okay with this price and would like to process If they answer No, write some message and quit the program. o o If they answer Yes, ▪ call another function to get the co-signers information (struct client) when done getting the info, call another function to print back all the clients information ▪ you can also print the price per person in the end when printing out each person's cost. It's up to you. III. other functions (it' up to you to have more functions, I'm giving the 3 required functions. Doesn't have to be exactly the same. This is a guide.): ▪ printCars() function: o prints all the used cars the dealership have from the global array. getClientInfo() function (or whatever you want to call it): o take an order struct o create an array of struct client. o loop through each client and get their information (name, creditScore,...) and save the info in the struct client array. o call printClientInfo() function to print back the information after. (You should not print the information right after the scanning the information, it should be done at the end and all the passengers info are printed together). ▪ printClientInfo() function (or whatever you want to call it): o take an array of struct client o loop through each client and print out their information
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education