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:
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 pricePerPerson;
};
struct client
{
char firstName[length];
char lastName[length];
bool isEmployed;
int creditScore;
};
(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).
Run 1: Quit when input 0 for carID
Welcome to ECE131 Dealership.
Now, are we looking for (U)sed or (N)ew car: u
Cool! I got you. Got it! Here are the used cars info we have.
Car ID: 1. 2013 Honda Accord. Mileage: 117121. Cost: $15234.56
Car ID: 2. 2022 Ford Mustang GT. Mileage: 100. Cost: $55000.99
Car ID: 3. 2008 Jeep Liberty. Mileage: 130000. Cost: $5677.87
Car ID: 4. 2019 Tesla X. Mileage: 24000. Cost: $84000.00
Have you chosen the car you like? Enter the carID (choose 0 if you want to quit): 0
See you again soon hopefully. Bye now.
Run 2: Reinput when carID is invalid, and stop when Clients say not OK with the Price
Welcome to ECE131 Dealership.
Now, are we looking for (U)sed or (N)ew car: u
Cool! I got you. Got it! Here are the used cars info we have.
Car ID: 1. 2013 Honda Accord. Mileage: 117121. Cost: $15234.56
Car ID: 2. 2022 Ford Mustang GT. Mileage: 100. Cost: $55000.99
Car ID: 3. 2008 Jeep Liberty. Mileage: 130000. Cost: $5677.87
Car ID: 4. 2019 Tesla X. Mileage: 24000. Cost: $84000.00
Have you chosen the car you like? Enter the carID (choose 0 if you want to quit): 5
You gave me an invalid car ID. Please input again: 3
Thank you. Last question before we can start the process. How many people buying this car. Enter here: 2
Great. So you chose carID 3.
The cost of this car will be 5477.87. Would you be OK with that? Enter here (Y/N): n
It's sad to see you go. Bye.
Run 3: Didn't want to buy the car last minute. Quit!
Welcome to ECE131 Dealership.
Now, are we looking for (U)sed or (N)ew car: u
Cool! I got you. Got it! Here are the used cars info we have.
Car ID: 1. 2013 Honda Accord. Mileage: 117121. Cost: $15234.56
Car ID: 2. 2022 Ford Mustang GT. Mileage: 100. Cost: $55000.99
Car ID: 3. 2008 Jeep Liberty. Mileage: 130000. Cost: $5677.87
Car ID: 4. 2019 Tesla X. Mileage: 24000. Cost: $84000.00
Have you chosen the car you like? Enter the carID (choose 0 if you want to quit): 4
Thank you. Last question before we can start the process. How many people buying this car. Enter here: 2
Great. So you chose carID 4.
The cost of this car will be 84000.00. Would you be OK with that? Enter here (Y/N): Y
Great! We'll start getting the cosigners information then!
You have 2 people buying this car. I'll process them one by one.
Processing Cosigner #1. Please enter first name followed by Last Name: first name
Thank you. Do you currently have a job (Y)es or (N)o: y
Enter your credit score: 765
Thank you! You're set :)
Processing Cosigner #1. Please enter first name followed by Last Name: last name
Thank you. Do you currently have a job (Y)es or (N)o: n
Enter your credit score: 222
Thank you! You're set :)
Everything looks good. The price per person remains at 42000.00.
Do you want to confirm and finish the purchase (Y/N): n
Come back next time when you change your mind. Bye.
Thank you! You're set :)
Run 4: Reinput when carID is invalid, purchase the car, and start a new order
Welcome to ECE131 Dealership.
Now, are we looking for (U)sed or (N)ew car: u
Cool! I got you. Got it! Here are the used cars info we have.
Car ID: 1. 2013 Honda Accord. Mileage: 117121. Cost: $15234.56
Car ID: 2. 2022 Ford Mustang GT. Mileage: 100. Cost: $55000.99
Car ID: 3. 2008 Jeep Liberty. Mileage: 130000. Cost: $5677.87
Car ID: 4. 2019 Tesla X. Mileage: 24000. Cost: $84000.00
Have you chosen the car you like? Enter the carID (choose 0 if you want to quit): 5
You gave me an invalid car ID. Please input again: 6
You gave me an invalid car ID. Please input again: 7
You gave me an invalid car ID. Please input again: 3
Thank you. Last question before we can start the process. How many people buying this car. Enter here: 2
Great. So you chose carID 3.
The cost of this car will be 5677.87. Would you be OK with that? Enter here (Y/N): Y
Great! We'll start getting the cosigners information then!
You have 2 people buying this car. I'll process them one by one.
Processing Cosigner #1. Please enter first name followed by Last Name: Jade Valentino
Thank you. Do you currently have a job (Y)es or (N)o: n
Enter your credit score: 123
Thank you! You're set :)
Processing Cosigner #1. Please enter first name followed by Last Name: Lily Smith
Thank you. Do you currently have a job (Y)es or (N)o: Y
Enter your credit score: 666
Thank you! You're set :)
Everything looks good. The price per person remains at 2838.94.
Do you want to confirm and finish the purchase (Y/N): Y
PROCESSING ....
Awesome!! I have purchased the cars. Here's the information about the buyers of your car. You have a wonderful time.
Client #1: Jade Valentino. Credit Score: 123. Employed: 70.
Client #2: Lily Smith. Credit Score: 666. Employed: 89.
Thank you for choosing our agency. Would you like to input another purchase? Enter here (Y/N): Y
Welcome to ECE131 Dealership.
Now, are we looking for (U)sed or (N)ew car: u
Cool! I got you. Got it! Here are the used cars info we have.
Car ID: 1. 2013 Honda Accord. Mileage: 117121. Cost: $15234.56
Car ID: 2. 2022 Ford Mustang GT. Mileage: 100. Cost: $55000.99
Car ID: 3. 2008 Jeep Liberty. Mileage: 130000. Cost: $5677.87
Car ID: 4. 2019 Tesla X. Mileage: 24000. Cost: $84000.00
The previous task asks you to help and purchase used cars. We can expand to include new cars as well. Your structs would need more information as below:
struct used_car
{
int carID;
char brand[length];
char make[length];
int year;
int mileage;
float price;
};
struct new_car
{
int carID;
char brand[length];
char make[length];
float waitTime;
float price;
int minCred;
bool needEmployment;
};
struct order
{
int numCosigned;
int carID;
float pricePerPerson;
int min_creds;
char need_employed;
bool buyNew;
int verifiedCosigners;
};
struct client
{
char firstName[length];
char lastName[length];
bool isEmployed;
int creditScore;
};
Assumptions: