4
answers
0
watching
148
views

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;
}

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

Unlock all answers

Get 1 free homework help answer.
Already have an account? Log in
Already have an account? Log in
Avatar image
Read by 1 person
Already have an account? Log in
Avatar image
Read by 2 people
Already have an account? Log in

Related questions

Weekly leaderboard

Start filling in the gaps now
Log in