Homework Help for Information Technology

1,532 results

IT encompasses the study, use, and service of coputers and communication systems for storing, sending, receiving and manipulation data and information

For unlimited access to Homework Help, a Homework+ subscription is required.

Lv1
in Information TechnologyĀ·
17 Apr 2023

please fix error in this code I created. I am also looking for a step by step explenation of my code to present to my class.Ā  Ā  ERROR!
gcc /tmp/0r6YqofOoW.c -lm
/usr/bin/ld: cannot open output file a.out: Permission denied
collect2: error: ld returned 1 exit statusĀ  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  #include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX_BRANCHES 5
#define MIN_CARS_PER_BRANCH 5
#define MAX_CARS_PER_BRANCH 10

#define CAD_TO_USD 0.8
#define CAD_TO_MXN 15.0
#define USD_TO_MXN 20.0

#define GROUP_1_BRANDS 5
#define GROUP_2_BRANDS 4
#define GROUP_3_BRANDS 6

#define MAX_MODEL_LENGTH 50
#define MAX_MANUFACTURER_LENGTH 50
#define MAX_CONDITION_LENGTH 10
#define MAX_COLOR_LENGTH 20
#define MAX_COUNTRY_LENGTH 20

typedef struct {
Ā  Ā  int length;
Ā  Ā  int width;
Ā  Ā  int height;
} Dimensions;

typedef struct {
Ā  Ā  char type[20];
Ā  Ā  Dimensions dimensions;
} Chassis;

typedef struct {
Ā  Ā  char make[20];
Ā  Ā  char model[20];
Ā  Ā  int year;
Ā  Ā  char color[20];
Ā  Ā  int mileage;
Ā  Ā  char location[20];
Ā  Ā  Chassis chassis;
Ā  Ā  Dimensions exterior;
Ā  Ā  int seats;
Ā  Ā  char upholstery[20];
Ā  Ā  float price;
} Car;

typedef struct {
Ā  Ā  char name[20];
Ā  Ā  char location[20];
Ā  Ā  Car inventory[100];
Ā  Ā  int count;
} Branch;

typedef struct {
Ā  Ā  Branch branches[10];
Ā  Ā  int count;
} Dealership;

// Function prototypes
int menu();
void sell_car(Dealership *dealership);
void buy_car(Dealership *dealership);
void transfer_car(Dealership *dealership);
void supply_cars(Dealership *dealership);
void print_branch_info(Branch *branch);
void print_car_info(Car *car) {
Ā  Ā  printf("Make: %s\n", car->make);
Ā  Ā  printf("Model: %s\n", car->model);
Ā  Ā  printf("Year: %d\n", car->year);
Ā  Ā  printf("Color: %s\n", car->color);
Ā  Ā  printf("Mileage: %d\n", car->mileage);
Ā  Ā  printf("Location: %s\n", car->location);
Ā  Ā  printf("Chassis Type: %s\n", car->chassis.type);
Ā  Ā  printf("Chassis Dimensions: L%d x W%d x H%d\n", car->chassis.dimensions.length, car->chassis.dimensions.width, car->chassis.dimensions.height);
Ā  Ā  printf("Exterior Dimensions: L%d x W%d x H%d\n", car->exterior.length, car->exterior.width, car->exterior.height);
Ā  Ā  printf("Seats: %d\n", car->seats);
Ā  Ā  printf("Upholstery: %s\n", car->upholstery);
Ā  Ā  printf("Price: %.2f\n", car->price);
}

int main() {
Ā  Ā  Dealership dealership;
Ā  Ā  dealership.count = 0;

Ā  Ā  int choice;
Ā  Ā  do {
Ā  Ā  Ā  Ā  choice = menu();
Ā  Ā  Ā  Ā  switch (choice) {
Ā  Ā  Ā  Ā  Ā  Ā  case 1:
Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  sell_car(&dealership);
Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  break;
Ā  Ā  Ā  Ā  Ā  Ā  case 2:
Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  buy_car(&dealership);
Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  break;
Ā  Ā  Ā  Ā  Ā  Ā  case 3:
Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  transfer_car(&dealership);
Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  break;
Ā  Ā  Ā  Ā  Ā  Ā  case 4:
Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  supply_cars(&dealership);
Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  break;
Ā  Ā  Ā  Ā  Ā  Ā  case 5:
Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  printf("Goodbye!\n");
Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  break;
Ā  Ā  Ā  Ā  Ā  Ā  default:
Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  printf("Invalid choice\n");
Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  break;
Ā  Ā  Ā  Ā  }
Ā  Ā  } while (choice != 5);

Ā  Ā  return 0;
}

int menu() {
Ā  Ā  int choice;
Ā  Ā  printf("1. Sell a car\n");
Ā  Ā  printf("2. Buy a car\n");
Ā  Ā  printf("3. Transfer a car\n");
Ā  Ā  printf("4. Supply cars\n");
Ā  Ā  printf("5. Quit\n");
Ā  Ā  printf("Enter your choice: ");
Ā  Ā  scanf("%d", &choice);
Ā  Ā  return choice;
}

void sell_car(Dealership *dealership) {
Ā  Ā  int branch_choice, car_choice;
Ā  Ā  printf("Which branch is selling the car?\n");
Ā  Ā  for (int i = 0; i < dealership->count; i++) {
Ā  Ā  Ā  Ā  printf("%d. %s\n", i + 1, dealership->branches[i].name);
Ā  Ā  }
Ā  Ā  printf("Enter your choice: ");
Ā  Ā  scanf("%d", &branch_choice);
Ā  Ā  branch_choice--;
Ā  Ā  if (branch_choice < 0 || branch_choice >= dealership->count) {
Ā  Ā  Ā  Ā  printf("Invalid branch choice\n");
Ā  Ā  Ā  Ā  return;
Ā  Ā  }
Ā  Ā  Branch *branch = &dealership->branches[branch_choice];
Ā  Ā  if (branch->count == 0) {
Ā  Ā  Ā  Ā  printf("No cars to sell\n");
Ā  Ā  Ā  Ā  return;
Ā  Ā  }
Ā  Ā printf("Which car is being sold?\n");
for (int i = 0; i < branch->count; i++) {
printf("%d. %s %s\n", i + 1, branch->inventory[i].make, branch->inventory[i].model);
}
printf("Enter your choice: ");
scanf("%d", &car_choice);
car_choice--;
if (car_choice < 0 || car_choice >= branch->count) {
printf("Invalid car choice\n");
return;
}
Car *car = & branch->inventory[car_choice];
// Update inventory after selling car
for (int i = car_choice; i < branch->count - 1; i++) {
Ā  Ā  branch->inventory[i] = branch->inventory[i + 1];
}
branch->count--;

printf("Car sold successfully!\n");
}

void buy_car(Dealership *dealership) {
printf("Enter branch ID: ");
int branch_id;
scanf("%d", &branch_id);
if (branch_id < 0 || branch_id >= dealership->count) {
printf("Invalid branch ID\n");
return;
}

Branch *branch = &dealership->branches[branch_id];

if (branch->count == 100) {
Ā  Ā  printf("Branch inventory is full. Cannot buy more cars.\n");
Ā  Ā  return;
}

Car car;

printf("Enter car make: ");
scanf("%s", car.make);

printf("Enter car model: ");
scanf("%s", car.model);

printf("Enter car year: ");
scanf("%d", &car.year);

printf("Enter car color: ");
scanf("%s", car.color);

printf("Enter car mileage: ");
scanf("%d", &car.mileage);

printf("Enter car location: ");
scanf("%s", car.location);

printf("Enter car type: ");
scanf("%s", car.chassis.type);

printf("Enter car dimensions (length width height): ");
scanf("%d %d %d", &car.chassis.dimensions.length, &car.chassis.dimensions.width, &car.chassis.dimensions.height);

printf("Enter car exterior dimensions (length width height): ");
scanf("%d %d %d", &car.exterior.length, &car.exterior.width, &car.exterior.height);

printf("Enter car seats: ");
scanf("%d", &car.seats);

printf("Enter car upholstery: ");
scanf("%s", car.upholstery);

printf("Enter car price: ");
scanf("%f", &car.price);

branch->inventory[branch->count] = car;
branch->count++;

printf("Car bought successfully!\n");
}

void transfer_car(Dealership *dealership) {
Ā  Ā  printf("Enter source branch ID: ");
Ā  Ā  int source_branch_id;
Ā  Ā  scanf("%d", &source_branch_id);
Ā  Ā  if (source_branch_id < 0 || source_branch_id >= dealership->count) {
Ā  Ā  Ā  Ā  printf("Invalid source branch ID\n");
Ā  Ā  Ā  Ā  return;
Ā  Ā  }

Ā  Ā  printf("Enter destination branch ID: ");
Ā  Ā  int dest_branch_id;
Ā  Ā  scanf("%d", &dest_branch_id);
Ā  Ā  if (dest_branch_id < 0 || dest_branch_id >= dealership->count) {
Ā  Ā  Ā  Ā  printf("Invalid destination branch ID\n");
Ā  Ā  Ā  Ā  return;
Ā  Ā  }

Ā  Ā  Branch *source_branch = &dealership->branches[source_branch_id];
Ā  Ā  Branch *dest_branch = &dealership->branches[dest_branch_id];

Ā  Ā  if (source_branch->count == 0) {
Ā  Ā  Ā  Ā  printf("No cars to transfer\n");
Ā  Ā  Ā  Ā  return;
Ā  Ā  }

Ā  Ā  printf("Which car do you want to transfer?\n");
Ā  Ā  for (int i = 0; i < source_branch->count; i++) {
Ā  Ā  Ā  Ā  printf("%d. %s %s\n", i + 1, source_branch->inventory[i].make, source_branch->inventory[i].model);
Ā  Ā  }
Ā  Ā  printf("Enter your choice: ");
Ā  Ā  int car_choice;
Ā  Ā  scanf("%d", &car_choice);
Ā  Ā  car_choice--;
Ā  Ā  if (car_choice < 0 || car_choice >= source_branch->count) {
Ā  Ā  Ā  Ā  printf("Invalid car choice\n");
Ā  Ā  Ā  Ā  return;
Ā  Ā  }

Ā  Ā  Car *car = &source_branch->inventory[car_choice];

Ā  Ā  // Update inventory in source branch after transferring car
Ā  Ā  for (int i = car_choice; i < source_branch->count - 1; i++) {
Ā  Ā  Ā  Ā  source_branch->inventory[i] = source_branch->inventory[i + 1];
Ā  Ā  }
Ā  Ā  source_branch->count--;

Ā  Ā  // Check if destination branch has enough space to receive the car
Ā  Ā  if (dest_branch->count == 100) {
Ā  Ā  Ā  Ā  printf("Destination branch inventory is full. Cannot transfer car.\n");
Ā  Ā  Ā  Ā  // Add the transferred car back to the source branch inventory
Ā  Ā  Ā  Ā  source_branch->inventory[source_branch->count] = *car;
Ā  Ā  Ā  Ā  source_branch->count++;
Ā  Ā  Ā  Ā  return;
Ā  Ā  }

Ā  Ā  // Add the transferred car to the destination branch inventory
Ā  Ā  dest_branch->inventory[dest_branch->count] = *car;
Ā  Ā  dest_branch->count++;

Ā  Ā  printf("Car transferred successfully!\n");
}

Avatar image
asdcsacwacac asked for the first time
Lv1
in Information TechnologyĀ·
14 Apr 2023

Hi. I added the struct you generated for my project code. However im still getting only output for vehicle info but no county, sity, contact, address etc.Ā  Can you please help me get the exact output I need for this project to be completed? Also here is the entire code all together. Thx.Ā  Ā  Ā  Ā  Ā  #include <stdio.h>
#include <stdbool.h>
#include <string.h>

// Define constants for currency conversion rates
#define USD_TO_CAD 1.3
#define USD_TO_MXN 21.0

// Define structs for different features and specifications of a car
struct Engine {
Ā  Ā  char type[20];
Ā  Ā  int horsepower;
};

struct Chassis {
Ā  Ā  int weight;
Ā  Ā  double length; // changed to double
};

struct Exterior {
Ā  Ā  char color[20];
Ā  Ā  bool upgradeableColor;
};

struct SeatingAndTrim {
Ā  Ā  char trim1[20];
Ā  Ā  char trim2[20];
};

struct Dimensions {
Ā  Ā  double height; // changed to double
Ā  Ā  double width; // changed to double
};

struct FuelEconomy {
Ā  Ā  int cityMPG;
Ā  Ā  int highwayMPG;
};

struct Car {
Ā  Ā  char model[20];
Ā  Ā  char manufacturer[20];
Ā  Ā  struct Exterior exterior;
Ā  Ā  int mileage;
Ā  Ā  bool isAutomatic;
Ā  Ā  struct Engine engine;
Ā  Ā  struct Chassis chassis;
Ā  Ā  struct SeatingAndTrim seatingAndTrim;
Ā  Ā  struct Dimensions dimensions;
Ā  Ā  bool hasAirbags;
Ā  Ā  int numAirbags;
Ā  Ā  struct FuelEconomy fuelEconomy;
Ā  Ā  bool isHybrid;
Ā  Ā  bool isFullyElectrified;
Ā  Ā  bool hasAutoParkingAssist;
Ā  Ā  bool hasNightVisionAssist;
Ā  Ā  bool hasCruiseControl;
Ā  Ā  bool is2WD;
Ā  Ā  bool hasHillAssist;
Ā  Ā  bool hasTPMS;
Ā  Ā  bool hasVoiceCommand;
Ā  Ā  bool hasLaneChangeIndicator;
Ā  Ā  bool hasForwardCollisionWarning;
Ā  Ā  bool hasBlindSpotWarning;
Ā  Ā  int numSeatHeaters;
Ā  Ā  bool hasSteeringHeater;
};

// Create struct for a branch
struct Branch {
Ā  Ā  char address[100]; // Increased array size
Ā  Ā  char postalCode[10];
Ā  Ā  char phoneNumber[20];
Ā  Ā  char faxNumber[20];
Ā  Ā  char customerServiceEmail[50];
Ā  Ā  char gmName[50];
Ā  Ā  char gmPhoneNumber[20];
Ā  Ā  char gmCellPhoneNumber[20];
Ā  Ā  char gmAddress[100]; // Increased array size
Ā  Ā  char gmEmail[50];
Ā  Ā  char gmDateOfEmployment[20];
Ā  Ā  int gmYearsOfExperience;
Ā  Ā  char financeManagerFirstName[20];
Ā  Ā  char financeManagerLastName[20];
Ā  Ā  char financeManagerPhoneNumber[20];
Ā  Ā  char financeManagerCellPhoneNumber[20];
Ā  Ā  char financeManagerAddress[100]; // Increased array size
Ā  Ā  char financeManagerDateOfEmployment[20];
Ā  Ā  int financeManagerYearsOfExperience;
Ā  Ā  int numAvailableCars;
Ā  Ā  struct Car inventory[10]; // Increased array size
};

// Create struct for a transfer
struct Transfer {
Ā  Ā  int transferId;
Ā  Ā  struct Car car;
Ā  Ā  struct Branch sourceBranch;
Ā  Ā  struct Branch destinationBranch;
Ā  Ā  double transferFee;
Ā  Ā  double currencyRate;
};
int main() {
Ā  Ā  struct Car exampleCar = {
Ā  Ā  Ā  Ā  .model = "Accord",
Ā  Ā  Ā  Ā  .manufacturer = "Honda",
Ā  Ā  Ā  Ā  .exterior.color = "White / Black",
Ā  Ā  Ā  Ā  .exterior.upgradeableColor = true,
Ā  Ā  Ā  Ā  .mileage = 0,
Ā  Ā  Ā  Ā  .isAutomatic = false,
Ā  Ā  Ā  Ā  .engine.type = "4-cylinder",
Ā  Ā  Ā  Ā  .engine.horsepower = 158,
Ā  Ā  Ā  Ā  .chassis.weight = 2902,
Ā  Ā  Ā  Ā  .chassis.length = 183.1,
Ā  Ā  Ā  Ā  .dimensions.height = 55.7,
Ā  Ā  Ā  Ā  .dimensions.width = 70.8,
Ā  Ā  Ā  Ā  .seatingAndTrim.trim1 = "EX",
Ā  Ā  Ā  Ā  .seatingAndTrim.trim2 = "EX-L Touring V6",
Ā  Ā  Ā  Ā  .hasAirbags = true,
Ā  Ā  Ā  Ā  .numAirbags = 6,
Ā  Ā  Ā  Ā  .fuelEconomy.cityMPG = 32,
Ā  Ā  Ā  Ā  .fuelEconomy.highwayMPG = 42,
Ā  Ā  Ā  Ā  .isHybrid = false,
Ā  Ā  Ā  Ā  .isFullyElectrified = false,
Ā  Ā  Ā  Ā  .hasAutoParkingAssist = false,
Ā  Ā  Ā  Ā  .hasNightVisionAssist = false,
Ā  Ā  Ā  Ā  .hasCruiseControl = true,
Ā  Ā  Ā  Ā  .is2WD = true,
Ā  Ā  Ā  Ā  .hasHillAssist = true,
Ā  Ā  Ā  Ā  .hasTPMS = true,
Ā  Ā  Ā  Ā  .hasVoiceCommand = true,
Ā  Ā  Ā  Ā  .hasLaneChangeIndicator = true,
Ā  Ā  Ā  Ā  .hasForwardCollisionWarning = true,
Ā  Ā  Ā  Ā  .hasBlindSpotWarning = true,
Ā  Ā  Ā  Ā  .numSeatHeaters = 2,
Ā  Ā  Ā  Ā  .hasSteeringHeater = true
Ā  Ā  };

Ā  Ā  printf("Car Details:\n");
Ā  Ā  printf("Model: %s\n", exampleCar.model);
Ā  Ā  printf("Manufacturer: %s\n", exampleCar.manufacturer);
Ā  Ā  printf("Exterior Color: %s\n", exampleCar.exterior.color);
Ā  Ā  printf("Upgradeable Exterior Color: %s\n", exampleCar.exterior.upgradeableColor ? "Yes" : "No");
Ā  Ā  printf("Mileage: %d\n", exampleCar.mileage);
Ā  Ā  printf("Automatic Transmission: %s\n", exampleCar.isAutomatic ? "Yes" : "No");
Ā  Ā  printf("Engine Type: %s\n", exampleCar.engine.type);
Ā  Ā  printf("Horsepower: %d\n", exampleCar.engine.horsepower);
Ā  Ā  printf("Chassis Weight: %d\n", exampleCar.chassis.weight);
Ā  Ā  printf("Chassis Length: %.1f\n", exampleCar.chassis.length);
Ā  Ā  printf("Dimensions Height: %.1f\n", exampleCar.dimensions.height);
Ā  Ā  printf("Dimensions Width: %.1f\n", exampleCar.dimensions.width);
Ā  Ā  printf("Seating and Trim Option 1: %s\n", exampleCar.seatingAndTrim.trim1);
Ā  Ā  printf("Seating and Trim Option 2: %s\n", exampleCar.seatingAndTrim.trim2);
Ā  Ā  printf("Airbags: %s\n", exampleCar.hasAirbags ? "Yes" : "No");
Ā  Ā  printf("Number of Airbags: %d\n", exampleCar.numAirbags);
Ā  Ā  printf("Fuel Economy - City MPG: %d\n", exampleCar.fuelEconomy.cityMPG);
Ā  Ā  printf("Fuel Economy - Highway MPG: %d\n", exampleCar.fuelEconomy.highwayMPG);
Ā  Ā  printf("Hybrid: %s\n", exampleCar.isHybrid ? "Yes" : "No");
Ā  Ā  printf("Fully Electrified: %s\n", exampleCar.isFullyElectrified ? "Yes" : "No");
Ā  Ā  printf("Auto Parking Assist: %s\n", exampleCar.hasAutoParkingAssist ? "Yes" : "No");
Ā  Ā  printf("Night Vision Assist: %s\n", exampleCar.hasNightVisionAssist ? "Yes" : "No");
Ā  Ā  printf("Cruise Control: %s\n", exampleCar.hasCruiseControl ? "Yes" : "No");
Ā  Ā  printf("2WD: %s\n", exampleCar.is2WD ? "Yes" : "No");
Ā  Ā  printf("Hill Assist: %s\n", exampleCar.hasHillAssist ? "Yes" : "No");
Ā  Ā  printf("TPMS: %s\n", exampleCar.hasTPMS ? "Yes" : "No");
Ā  Ā  printf("Voice Command: %s\n", exampleCar.hasVoiceCommand ? "Yes" : "No");
Ā  Ā  printf("Lane Change Indicator: %s\n", exampleCar.hasLaneChangeIndicator ? "Yes" : "No");
Ā  Ā  printf("Forward Collision Warning: %s\n", exampleCar.hasForwardCollisionWarning ? "Yes" : "No");
Ā  Ā  printf("Blind Spot Warning: %s\n", exampleCar.hasBlindSpotWarning ? "Yes" : "No");
Ā  Ā  printf("Number of Seat Heaters: %d\n", exampleCar.numSeatHeaters);
Ā  Ā  printf("Steering Heater: %s\n", exampleCar.hasSteeringHeater ? "Yes" : "No");

Ā  Ā  return 0;
}

Lv1
in Information TechnologyĀ·
13 Apr 2023

Hello. Heres my code i generated for my project. I also copy past the output. However, if someone can go over my C code because my output only shows car info and not everything els ie: country, city, dealership, contacts etc. If you can kindly fix this output proble that would be aces! Thx.

Ā 

#include <stdio.h>
#include <stdbool.h>
#include <string.h>

// Define constants for currency conversion rates
#define USD_TO_CAD 1.3
#define USD_TO_MXN 21.0

// Define structs for different features and specifications of a car
struct Engine {
Ā  Ā  char type[20];
Ā  Ā  int horsepower;
};

struct Chassis {
Ā  Ā  int weight;
Ā  Ā  double length; // changed to double
};

struct Exterior {
Ā  Ā  char color[20];
Ā  Ā  bool upgradeableColor;
};

struct SeatingAndTrim {
Ā  Ā  char trim1[20];
Ā  Ā  char trim2[20];
};

struct Dimensions {
Ā  Ā  double height; // changed to double
Ā  Ā  double width; // changed to double
};

struct FuelEconomy {
Ā  Ā  int cityMPG;
Ā  Ā  int highwayMPG;
};

struct Car {
Ā  Ā  char model[20];
Ā  Ā  char manufacturer[20];
Ā  Ā  struct Exterior exterior;
Ā  Ā  int mileage;
Ā  Ā  bool isAutomatic;
Ā  Ā  struct Engine engine;
Ā  Ā  struct Chassis chassis;
Ā  Ā  struct SeatingAndTrim seatingAndTrim;
Ā  Ā  struct Dimensions dimensions;
Ā  Ā  bool hasAirbags;
Ā  Ā  int numAirbags;
Ā  Ā  struct FuelEconomy fuelEconomy;
Ā  Ā  bool isHybrid;
Ā  Ā  bool isFullyElectrified;
Ā  Ā  bool hasAutoParkingAssist;
Ā  Ā  bool hasNightVisionAssist;
Ā  Ā  bool hasCruiseControl;
Ā  Ā  bool is2WD;
Ā  Ā  bool hasHillAssist;
Ā  Ā  bool hasTPMS;
Ā  Ā  bool hasVoiceCommand;
Ā  Ā  bool hasLaneChangeIndicator;
Ā  Ā  bool hasForwardCollisionWarning;
Ā  Ā  bool hasBlindSpotWarning;
Ā  Ā  int numSeatHeaters;
Ā  Ā  bool hasSteeringHeater;
};

// Create struct for a branch
struct Branch {
Ā  Ā  char address[100]; // Increased array size
Ā  Ā  char postalCode[10];
Ā  Ā  char phoneNumber[20];
Ā  Ā  char faxNumber[20];
Ā  Ā  char customerServiceEmail[50];
Ā  Ā  char gmName[50];
Ā  Ā  char gmPhoneNumber[20];
Ā  Ā  char gmCellPhoneNumber[20];
Ā  Ā  char gmAddress[100]; // Increased array size
Ā  Ā  char gmEmail[50];
Ā  Ā  char gmDateOfEmployment[20];
Ā  Ā  int gmYearsOfExperience;
Ā  Ā  char financeManagerFirstName[20];
Ā  Ā  char financeManagerLastName[20];
Ā  Ā  char financeManagerPhoneNumber[20];
Ā  Ā  char financeManagerCellPhoneNumber[20];
Ā  Ā  char financeManagerAddress[100]; // Increased array size
Ā  Ā  char financeManagerDateOfEmployment[20];
Ā  Ā  int financeManagerYearsOfExperience;
Ā  Ā  int numAvailableCars;
Ā  Ā  struct Car inventory[10]; // Increased array size
};

// Create struct for a transfer
struct Transfer {
Ā  Ā  int transferId;
Ā  Ā  struct Car car;
Ā  Ā  struct Branch sourceBranch;
Ā  Ā  struct Branch destinationBranch;
Ā  Ā  double transferFee;
Ā  Ā  double currencyRate;
};//Corrected the missing value

int main() {
Ā  Ā  struct Car exampleCar = {
Ā  Ā  Ā  Ā  .model = "Accord",
Ā  Ā  Ā  Ā  .manufacturer = "Honda",
Ā  Ā  Ā  Ā  .exterior.color = "White / Black",
Ā  Ā  Ā  Ā  .exterior.upgradeableColor = true,
Ā  Ā  Ā  Ā  .mileage = 0,
Ā  Ā  Ā  Ā  .isAutomatic = false,
Ā  Ā  Ā  Ā  .engine.type = "4-cylinder",
Ā  Ā  Ā  Ā  .engine.horsepower = 158,
Ā  Ā  Ā  Ā  .chassis.weight = 2902,
Ā  Ā  Ā  Ā  .chassis.length = 183.1,
Ā  Ā  Ā  Ā  .dimensions.height = 55.7,
Ā  Ā  Ā  Ā  .dimensions.width = 70.8,
Ā  Ā  Ā  Ā  .seatingAndTrim.trim1 = "EX",
Ā  Ā  Ā  Ā  .seatingAndTrim.trim2 = "EX-L Touring V6",
Ā  Ā  Ā  Ā  .hasAirbags = true,
Ā  Ā  Ā  Ā  .numAirbags = 6,
Ā  Ā  Ā  Ā  .fuelEconomy.cityMPG = 32,
Ā  Ā  Ā  Ā  .fuelEconomy.highwayMPG = 42,
Ā  Ā  Ā  Ā  .isHybrid = false,
Ā  Ā  Ā  Ā  .isFullyElectrified = false,
Ā  Ā  Ā  Ā  .hasAutoParkingAssist = false,
Ā  Ā  Ā  Ā  .hasNightVisionAssist = false,
Ā  Ā  Ā  Ā  .hasCruiseControl = true,
Ā  Ā  Ā  Ā  .is2WD = true,
Ā  Ā  Ā  Ā  .hasHillAssist = true,
Ā  Ā  Ā  Ā  .hasTPMS = true,
Ā  Ā  Ā  Ā  .hasVoiceCommand = true,
Ā  Ā  Ā  Ā  .hasLaneChangeIndicator = true,
Ā  Ā  Ā  Ā  .hasForwardCollisionWarning = true,
Ā  Ā  Ā  Ā  .hasBlindSpotWarning = true,
Ā  Ā  Ā  Ā  .numSeatHeaters = 2,
Ā  Ā  Ā  Ā  .hasSteeringHeater = true
Ā  Ā  };

Ā  Ā  printf("Car Details:\n");
Ā  Ā  printf("Model: %s\n", exampleCar.model);
Ā  Ā  printf("Manufacturer: %s\n", exampleCar.manufacturer);
Ā  Ā  printf("Exterior Color: %s\n", exampleCar.exterior.color);
Ā  Ā  printf("Upgradeable Exterior Color: %s\n", exampleCar.exterior.upgradeableColor ? "Yes" : "No");
Ā  Ā  printf("Mileage: %d\n", exampleCar.mileage);
Ā  Ā  printf("Automatic Transmission: %s\n", exampleCar.isAutomatic ? "Yes" : "No");
Ā  Ā  printf("Engine Type: %s\n", exampleCar.engine.type);
Ā  Ā  printf("Horsepower: %d\n", exampleCar.engine.horsepower);
Ā  Ā  printf("Chassis Weight: %d\n", exampleCar.chassis.weight);
Ā  Ā  printf("Chassis Length: %.1f\n", exampleCar.chassis.length);
Ā  Ā  printf("Dimensions Height: %.1f\n", exampleCar.dimensions.height);
Ā  Ā  printf("Dimensions Width: %.1f\n", exampleCar.dimensions.width);
Ā  Ā  printf("Seating and Trim Option 1: %s\n", exampleCar.seatingAndTrim.trim1);
Ā  Ā  printf("Seating and Trim Option 2: %s\n", exampleCar.seatingAndTrim.trim2);
Ā  Ā  printf("Airbags: %s\n", exampleCar.hasAirbags ? "Yes" : "No");
Ā  Ā  printf("Number of Airbags: %d\n", exampleCar.numAirbags);
Ā  Ā  printf("Fuel Economy - City MPG: %d\n", exampleCar.fuelEconomy.cityMPG);
Ā  Ā  printf("Fuel Economy - Highway MPG: %d\n", exampleCar.fuelEconomy.highwayMPG);
Ā  Ā  printf("Hybrid: %s\n", exampleCar.isHybrid ? "Yes" : "No");
Ā  Ā  printf("Fully Electrified: %s\n", exampleCar.isFullyElectrified ? "Yes" : "No");
Ā  Ā  printf("Auto Parking Assist: %s\n", exampleCar.hasAutoParkingAssist ? "Yes" : "No");
Ā  Ā  printf("Night Vision Assist: %s\n", exampleCar.hasNightVisionAssist ? "Yes" : "No");
Ā  Ā  printf("Cruise Control: %s\n", exampleCar.hasCruiseControl ? "Yes" : "No");
Ā  Ā  printf("2WD: %s\n", exampleCar.is2WD ? "Yes" : "No");
Ā  Ā  printf("Hill Assist: %s\n", exampleCar.hasHillAssist ? "Yes" : "No");
Ā  Ā  printf("TPMS: %s\n", exampleCar.hasTPMS ? "Yes" : "No");
Ā  Ā  printf("Voice Command: %s\n", exampleCar.hasVoiceCommand ? "Yes" : "No");
Ā  Ā  printf("Lane Change Indicator: %s\n", exampleCar.hasLaneChangeIndicator ? "Yes" : "No");
Ā  Ā  printf("Forward Collision Warning: %s\n", exampleCar.hasForwardCollisionWarning ? "Yes" : "No");
Ā  Ā  printf("Blind Spot Warning: %s\n", exampleCar.hasBlindSpotWarning ? "Yes" : "No");
Ā  Ā  printf("Number of Seat Heaters: %d\n", exampleCar.numSeatHeaters);
Ā  Ā  printf("Steering Heater: %s\n", exampleCar.hasSteeringHeater ? "Yes" : "No");

Ā  Ā  return 0;
}

Ā 

Car Details:
Model: Accord
Manufacturer: Honda
Exterior Color: White / Black
Upgradeable Exterior Color: Yes
Mileage: 0
Automatic Transmission: No
Engine Type: 4-cylinder
Horsepower: 158
Chassis Weight: 2902
Chassis Length: 183.1
Dimensions Height: 55.7
Dimensions Width: 70.8
Seating and Trim Option 1: EX
Seating and Trim Option 2: EX-L Touring V6
Airbags: Yes
Number of Airbags: 6
Fuel Economy - City MPG: 32
Fuel Economy - Highway MPG: 42
Hybrid: No
Fully Electrified: No
Auto Parking Assist: No
Night Vision Assist: No
Cruise Control: Yes
2WD: Yes
Hill Assist: Yes
TPMS: Yes
Voice Command: Yes
Lane Change Indicator: Yes
Forward Collision Warning: Yes
Blind Spot Warning: Yes
Number of Seat Heaters: 2
Steering Heater: Yes

Lv1
in Information TechnologyĀ·
13 Apr 2023

Can anyone complete my code?Ā  Ā  // Constants for fixed currency conversion rates
#define USD_TO_CAD_RATE 1.3
#define USD_TO_MXN_RATE 19.9

// Constants for promotion rates
#define CAN_HONDA_REBATE 0.02
#define MEX_VOLVO_REBATE 0.03
#define USA_LOYALTY_PROMOTION 0.025

// Constants for inventory
#define MIN_CARS_PER_BRANCH 5
#define MAX_CARS_PER_BRANCH 10

// Constants for car groups and their brands
#define NUM_GROUPS 3
#define MAX_BRANDS_PER_GROUP 6
const char *CAR_GROUPS[NUM_GROUPS] = {"Group 1", "Group 2", "Group 3"};
const char *CAR_BRANDS[NUM_GROUPS][MAX_BRANDS_PER_GROUP] = {
Ā  Ā  {"Kia", "Toyota", "Honda", "Mazda", "Nissan"},
Ā  Ā  {"Ford", "Genesis", "Volvo", "Acura", NULL},
Ā  Ā  {"BMW", "Audi", "Bentley", "Ferrari", "Aston Martin", "Bugatti"}
};

// Constants for car features
#define MAX_MODEL_LENGTH 50
#define MAX_COLOR_LENGTH 20
#define MAX_TRANSMISSION_LENGTH 20
#define MAX_ENGINE_LENGTH 50
#define MAX_CHASSIS_LENGTH 50
#define MAX_EXTERIOR_LENGTH 50
#define MAX_SEATING_TRIM_LENGTH 50
#define MAX_DIMENSIONS_LENGTH 50
#define MAX_FUEL_LENGTH 50
#define MAX_NUM_AIRBAGS 10
#define MAX_PHONE_LENGTH 20
#define MAX_EMAIL_LENGTH 50
#define MAX_ADDRESS_LENGTH 100
#define MAX_NAME_LENGTH 50
#define MAX_BRANCHES 5
#define MAX_CARS_PER_BRANCH 10

// Structs for car features
typedef struct {
Ā  Ā  char model[MAX_MODEL_LENGTH];
Ā  Ā  char manufacturer[MAX_NAME_LENGTH];
Ā  Ā  char color[MAX_COLOR_LENGTH];
Ā  Ā  int mileage;
Ā  Ā  char transmission[MAX_TRANSMISSION_LENGTH];
Ā  Ā  char engine[MAX_ENGINE_LENGTH];
Ā  Ā  char chassis[MAX_CHASSIS_LENGTH];
Ā  Ā  char exterior[MAX_EXTERIOR_LENGTH];
Ā  Ā  char seating_trim[MAX_SEATING_TRIM_LENGTH];
Ā  Ā  char dimensions[MAX_DIMENSIONS_LENGTH];
Ā  Ā  int has_airbags;
Ā  Ā  int num_airbags;
Ā  Ā  char fuel_economy[MAX_FUEL_LENGTH];
Ā  Ā  int is_hybrid;
Ā  Ā  int is_fully_electrified;
Ā  Ā  int has_automatic_parking;
Ā  Ā  int has_night_vision;
Ā  Ā  int has_cruise_control;
Ā  Ā  int is_4wd;
Ā  Ā  int has_hill_assist;
Ā  Ā  int has_tire_pressure_monitoring;
Ā  Ā  int has_voice_command;
Ā  Ā  int has_lane_change_indicator;
Ā  Ā  int has_forward_collision_warning;
Ā  Ā  int has_blind_spot_warning;
Ā  Ā  int num_seat_heaters;
Ā  Ā  int has_steering_heater;
} Car;

// Structs for branch information
typedef struct {
Ā  Ā  char address[MAX_ADDRESS_LENGTH];
Ā  Ā  char postal_code[MAX_ADDRESS_LENGTH];
Ā  Ā  char phone_number[MAX_PHONE_LENGTH];
Ā  Ā  char fax_number[MAX_PHONE_LENGTH];
Ā  Ā  char customer_service_email[MAX_EMAIL_LENGTH];
Ā  Ā  char general_manager_name[MAX_NAME_LENGTH];
Ā  Ā  char general_manager_phone[MAX_PHONE_LENGTH];
Ā  Ā  char general_manager_cell_phone[MAX_PHONE_LENGTH];
Ā  Ā  char general_manager_address[MAX_ADDRESS_LENGTH];
Ā  Ā  char general_manager_email[MAX_EMAIL_LENGTH];
Ā  Ā  char general_manager_date_of_employment[MAX_ADDRESS_LENGTH];
Ā  Ā  int general_manager_years_of_experience;
Ā  Ā  char finance_manager_name[MAX_NAME_LENGTH];
Ā  Ā  char finance_manager_phone[MAX_PHONE_LENGTH];
Ā  Ā  char finance_manager_cell_phone[MAX_PHONE_LENGTH];
Ā  Ā  char finance_manager_address[MAX_ADDRESS_LENGTH];
Ā  Ā 
// Struct for inventory management
typedef struct {
Car cars[MAX_CARS_PER_BRANCH];
int num_cars;
} Inventory;

// Function to convert USD to CAD
float convert_to_cad(float usd_amount) {
return usd_amount * USD_TO_CAD_RATE;
}

// Function to convert USD to MXN
float convert_to_mxn(float usd_amount) {
return usd_amount * USD_TO_MXN_RATE;
}

// Function to calculate rebate for a car based on the country and brand
float calculate_rebate(char* country, char* brand) {
float rebate = 0.0;
if (strcmp(country, "Canada") == 0 && strcmp(brand, "Honda") == 0) {
rebate = CAN_HONDA_REBATE;
} else if (strcmp(country, "Mexico") == 0 && strcmp(brand, "Volvo") == 0) {
rebate = MEX_VOLVO_REBATE;
} else if (strcmp(country, "USA") == 0) {
rebate = USA_LOYALTY_PROMOTION;
}
return rebate;
}

// Function to check if a given car is available in a given branch
int is_car_available(Inventory* inventory, char* model, char* manufacturer) {
int i;
for (i = 0; i < inventory->num_cars; i++) {
if (strcmp(inventory->cars[i].model, model) == 0 && strcmp(inventory->cars[i].manufacturer, manufacturer) == 0) {
return 1;
}
}
return 0;
}

// Main function
int main()Ā 
}

// Sample usage of the structs and functions
Inventory toronto_inventory = {
.num_cars = 3,
.cars =Ā 
{
.model = "Civic",
.manufacturer = "Honda",
.color = "Black",
.mileage = 5000,
.transmission = "Automatic",
.engine = "2.0L",
.chassis = "Sedan",
.exterior = "Sunroof",
.seating_trim = "Leather",
.dimensions = "Compact",
.has_airbags = 1,
.num_airbags = 6,
.fuel_economy = "City: 8.5 L/100 km, Hwy: 6.2 L/100 km",
.is_hybrid = 0,
.is_fully_electrified = 0,
.has_automatic_parking = 1,
.has_night_vision = 0,
.has_cruise_control = 1,
.is_4wd = 0,
.has_hill_assist = 1,
.has_tire_pressure_monitoring = 1,
.has_voice_command = 1,
.has_lane_change_indicator = 1,
.has_forward_collision_warning = 1,
.has_blind_spot_warning = 1,
.num_seat_heaters = 2,
.has_steering_heater = 1
},

.model = "Corolla",
.manufacturer = "Toyota",
.color = "Blue",
.mileage = 7000,
.transmission = "Automatic",
.engine = "1.8L",
.chassis = "Sedan",
.exterior = "Alloy Wheels",
.seating_trim = "Cloth",
.dimensions = "Compact",
.has_airbags = 1,
.num

Avatar image
sukanya333bhattacharyya answered this question
Lv1
in Information TechnologyĀ·
13 Apr 2023

Would you please help me fix/edit my below C code to output everything from the attached assignment below my C code.  If you could please read the step by step in the project as its very detailed and long. I really need a 100% completed code. Thx.

---------------------------------------------------------------------------------

#include <stdio.h>
#include <stdbool.h>
#include <string.h>

// Define constants for currency conversion rates
#define USD_TO_CAD 1.3
#define USD_TO_MXN 21.0

// Define structs for different features and specifications of a car
struct Engine {
    char type[20];
    int horsepower;
};

struct Chassis {
    int weight;
    int length;
};

struct Exterior {
    char color[20];
    bool upgradeableColor;
};

struct SeatingAndTrim { 
    char trim1[20];
    char trim2[20];
};

struct Dimensions {
    int height;
    int width;
};

struct FuelEconomy {
    int cityMPG;
    int highwayMPG;
};

struct Car {
    char model[20];
    char manufacturer[20];
    struct Exterior exterior;
    int mileage;
    bool isAutomatic;
    struct Engine engine;
    struct Chassis chassis;
    struct SeatingAndTrim seatingAndTrim;
    struct Dimensions dimensions;
    bool hasAirbags;
    int numAirbags;
    struct FuelEconomy fuelEconomy;
    bool isHybrid;
    bool isFullyElectrified;
    bool hasAutoParkingAssist;
    bool hasNightVisionAssist;
    bool hasCruiseControl;
    bool is2WD;
    bool hasHillAssist;
    bool hasTPMS;
    bool hasVoiceCommand;
    bool hasLaneChangeIndicator;
    bool hasForwardCollisionWarning;
    bool hasBlindSpotWarning;
    int numSeatHeaters;
    bool hasSteeringHeater;
};

sstruct Branch exampleBranch = {
    .address = "1234 Main St",
    .postalCode = "A1B 2C3",
    .phoneNumber = "123-456-7890",
    .faxNumber = "987-654-3210",
    .customerServiceEmail = "[email protected]",
    .gmName = "John Doe",
    .gmPhoneNumber = "111-222-3333",
    .gmCellPhoneNumber = "444-555-6666",
    .gmAddress = "5678 Elm St",
    .gmEmail = "[email protected]",
    .gmDateOfEmployment = "01/01/2010",
    .gmYearsOfExperience = 10,
    .financeManagerFirstName = "Jane",
    .financeManagerLastName = "Doe",
    .financeManagerPhoneNumber = "777-888-9999",
    .financeManagerCellPhoneNumber = "000-111-2222",
    .financeManagerAddress = "9876 Oak St",
    .financeManagerDateOfEmployment = "02/02/2015",
    .financeManagerYearsOfExperience = 6,
    .numAvailableCars = 10,
    .inventory = {exampleCar, exampleCar, exampleCar, exampleCar, exampleCar,
                  exampleCar, exampleCar, exampleCar, exampleCar, exampleCar}
};

// Calculate the price after applying rebate or promotion
double price = 50000;
const char* model = "Honda";
const char* manufacturer = "Honda";
const char* country = "Canada";
double convertedPrice = convertCurrency(price, country);
double finalPrice = applyRebateOrPromotion(convertedPrice, model, manufacturer, country);

printf("Original Price

// Function to calculate price after applying rebate or promotion
double applyRebateOrPromotion(double price, const char* model, const char* manufacturer, const char* country) {
    if (strcmp(model, "Honda") == 0 && strcmp(country, "Canada") == 0) {
        return price * 0.98; // 2% rebate for Honda in Canada
    }
    else if (strcmp(manufacturer, "Volvo") == 0 && price > 60000 && strcmp(country, "Mexico") == 0) {
        return price * 0.97; // 3% rebate for Volvo above 60,000 in Mexico
    }
    else if ((strcmp(manufacturer, "BMW") == 0 || strcmp(manufacturer, "Volvo") == 0 ||
        strcmp(manufacturer, "Audi") == 0 || strcmp(manufacturer, "Bentley") == 0 ||
        strcmp(manufacturer, "Ferrari") == 0) && strcmp(country, "USA") == 0) {
        return price * 0.975; // 2.5% promotion for eligible brands in USA
    }
    return price;
}

--------------------------------------------------------------------------------

In this project, you are working on the back end of a famous car dealership website.

The name of the dealership you are working with is your first name and your last name.

Your dealership has 5 different branches in 5 different cities in North America including Canada, USA, and Mexico. Therefore, the offers and prices are in three different currencies.

In case, you need to implement a conversion rate, you can implement a fixed rate; however, implementing a variable rate would be an advantage and you will receive extra points.

As an example, the rate to convert the USD to CAD can be assumed as a fixed rate of 1.3; though in reality, this rate could change from 1.2 to 1.4 on daily basis.

The same as the previous project you have gone through, you need to deal with an inventory.

In this project, each of the branches holds a minimum of 5 cars and a maximum of 10 cars.

The dealership works with the following brands which are divided into three different categories:

Group 1:

- Kia

- Toyota

- Honda

- Mazda

- Nissan



Group 2:

- Ford

- Genesis

- Volvo

- Acura



Group 3:

- BMW

- Audi

- Bentley

- Ferrari

- Aston Martin

- Bugatti



Each car you define MUST have two different trims.



The features and specifications you need to define for the cars are listed below:

- Model

- Manufacturer

- Color (upgradable)

- Mileage

- Manual/Automatic Transmission (upgradable)

- Engine (Engine struct)

- Chassis (Chassis struct)

- Exterior (Exterior struct)

- Seating & Trim (Seating & Trim struct)

- Dimensions (Dimensions struct)

- Airbags (Yes/No)

- number of the Airbags

- Fuel Economy (Fues Struct)

- Hybrid (Yes/No)

- Fully Electrified (Yes/No)

- Automatic Parking Assistance (Yes/No - Upgradable)

- Night Vision Assistance (Yes/No)

- Cruise Control (Yes/No - Upgradable)

- 2WD/4WD

- Hill assist

- Tire Pressure Monitoring System (Yes/No - Upgradable)

- Voice Command

- Lane Change Indicator

- Forward Collision Warning Sensor

- Blind spot warning sensors

- Seat heater (numbers)

- Steering heater (Yes/No)





Each branch has the following public information :

- Address

- Postal Code

- Phone number

- Fax Number

- Customer Service Email

- Name of the General Manager



Each branch has the following confidential information:

- General Manager’s phone number

- General Manager’s cell phone number

- General Manager’s address

- General Manager’s Email

- General Manager’s date of employment

- General Manager’s years of experience

- Finance Manager’s first name and last name

- Finance Manager’s phone number

- Finance Manager’s cell phone number

- Finance Manager’s address

- Finance Manager’s date of employment

- Finance Manager’s years of experience

- Number of the available cars

- Complete Information about the available cars

There are four different stories that your code must represent:

1. One of the branches of the dealership sells a car (The inventory must be updated)

2. One of the branches of the dealership buys a car (The inventory must be updated)

3. One of the branches of the dealership transfers a car from one branch to the other (the transfer expenses and the currency rate must be taken into consideration.)

4. The dealership supplies brand-new cars to the different branches


- All brand-new Honda in Canada has a 2% rebate as a credit.

- All brand-new Volvo above 60,000 in Mexico have a 3% rebate as credit.

- In the USA, there is a loyalty program for BMW, VOLVO, AUDI, BENTLEY, and Ferrari - If the customer is eligible for the loyalty program then a 2.5% promotion will be implemented to their purchase (not a rebate).


Your website has a search engine based on your available inventories of all the branches and the following inputs could be inserted from the user as the search criteria:

1. Car Model

2. Car Manufacturer

3. Brand-new / Used / Both

4. Range of mileage 

5. Price range

6. Color

7. Availability in the country (In this case, you initially need to determine the location)

Avatar image
sukanya333bhattacharyya answered this question
Lv1
in Information TechnologyĀ·
12 Apr 2023

Ā 

Ā 

In this project, you are working on the back end of a famous car dealership website.

The name of the dealership you are working with is your first name and your last name.

Your dealership has 5 different branches in 5 different cities in North America including Canada, USA, and Mexico. Therefore, the offers and prices are in three different currencies.

In case, you need to implement a conversion rate, you can implement a fixed rate; however, implementing a variable rate would be an advantage and you will receive extra points.

As an example, the rate to convert the USD to CAD can be assumed as a fixed rate of 1.3; though in reality, this rate could change from 1.2 to 1.4 on daily basis.

The same as the previous project you have gone through, you need to deal with an inventory.

In this project, each of the branches holds a minimum of 5 cars and a maximum of 10 cars.

The dealership works with the following brands which are divided into three different categories:

Group 1:

- Kia

- Toyota

- Honda

- Mazda

- Nissan



Group 2:

- Ford

- Genesis

- Volvo

- Acura



Group 3:

- BMW

- Audi

- Bentley

- Ferrari

- Aston Martin

- Bugatti



Each car you define MUST have two different trims.



The features and specifications you need to define for the cars are listed below:

- Model

- Manufacturer

- Color (upgradable)

- Mileage

- Manual/Automatic Transmission (upgradable)

- Engine (Engine struct)

- Chassis (Chassis struct)

- Exterior (Exterior struct)

- Seating & Trim (Seating & Trim struct)

- Dimensions (Dimensions struct)

- Airbags (Yes/No)

- number of the Airbags

- Fuel Economy (Fues Struct)

- Hybrid (Yes/No)

- Fully Electrified (Yes/No)

- Automatic Parking Assistance (Yes/No - Upgradable)

- Night Vision Assistance (Yes/No)

- Cruise Control (Yes/No - Upgradable)

- 2WD/4WD

- Hill assist

- Tire Pressure Monitoring System (Yes/No - Upgradable)

- Voice Command

- Lane Change Indicator

- Forward Collision Warning Sensor

- Blind spot warning sensors

- Seat heater (numbers)

- Steering heater (Yes/No)





Each branch has the following public information :

- Address

- Postal Code

- Phone number

- Fax Number

- Customer Service Email

- Name of the General Manager



Each branch has the following confidential information:

- General Managerā€™s phone number

- General Managerā€™s cell phone number

- General Managerā€™s address

- General Managerā€™s Email

- General Managerā€™s date of employment

- General Managerā€™s years of experience

- Finance Managerā€™s first name and last name

- Finance Managerā€™s phone number

- Finance Managerā€™s cell phone number

- Finance Managerā€™s address

- Finance Managerā€™s date of employment

- Finance Managerā€™s years of experience

- Number of the available cars

- Complete Information about the available cars

There are four different stories that your code must represent:

1. One of the branches of the dealership sells a car (The inventory must be updated)

2. One of the branches of the dealership buys a car (The inventory must be updated)

3. One of the branches of the dealership transfers a car from one branch to the other (the transfer expenses and the currency rate must be taken into consideration.)

4. The dealership supplies brand-new cars to the different branches


- All brand-new Honda in Canada has a 2% rebate as a credit.

- All brand-new Volvo above 60,000 in Mexico have a 3% rebate as credit.

- In the USA, there is a loyalty program for BMW, VOLVO, AUDI, BENTLEY, and Ferrari - If the customer is eligible for the loyalty program then a 2.5% promotion will be implemented to their purchase (not a rebate).


Your website has a search engine based on your available inventories of all the branches and the following inputs could be inserted from the user as the search criteria:

1. Car Model

2. Car Manufacturer

3. Brand-new / Used / Both

4. Range of mileageĀ 

5. Price range

6. Color

7. Availability in the country (In this case, you initially need to determine the location)


Start filling in the gaps now
Log in