Write a c program which uses a structure type

Assignment Help Computer Engineering
Reference no: EM132196855

Write a C program which uses a structure type that stores data records for a car, as described in the Requirements below. im using LYNX

Requirements:

Define a global structure and name it as Car.

This structure has these member variables:

· Make (string), model (string), year (int), mileage (double), original_price (double), and

· sale_price(double) o sale_price will be calculated based on original_price and mileage.

Declare two variables from structure car and call it car_number1 and car_number2.

Write a function called get_input, which is responsible to

· Get the input values for the member variables of car_number1 and car_number2

· For sale_price enter zero. This value will be updated later by function price_calculation

· This function uses call by reference for car_number1 and car_number2

· For string member variables use the correct input method

Write a function called price_calculation which gets car_number1 and car_number2 as input (call by reference) and update the sale_price.

· If the car mileage is greater than 70,000 miles then the sale_price is 70% of the original_price. Otherwise the sale_price is 85% of the original_price.

Write a function called print_output which is responsible

· To print the information for each car separately (including the update value of sale_price)

· This function should print the output based on alphabet order of car's make.

A sample run of your program for one item should look like below:

Enter the information for the first car

Enter the car's make: Toyota

Enter the car's model: Camry

Enter the car's year: 2000

Enter the car's mileage: 110000

Enter the car's original_price: 7000$

Enter the car's sale_price:0;

Enter the information for the second car

Enter the car's make: Ford

Enter the car's model: Mustang

Enter the car's year: 2014

Enter the car's mileage: 40000

Enter the car's original_price: 15000$

Enter the car's sale_price:0;

Check the car's information including the sale_price (ordered alphabetically)

Ford Mustang

year: 2014

mileage: 40000

sale_price: 12,750$

Toyota Camry

year: 2000

mileage: 110000

sale_price:4,900$

Compile your program using g++ -Wall program9.cpp -o output

Reference no: EM132196855

Questions Cloud

Implementing design thinking in established organisations : MGMT20140 - Design It - develop a written report critically discussing the challenges of implementing Design Thinking in established organisations
Industry power is responsible for predictive capabilities : Which of these sources of this industry’s power is most responsible for these predictive capabilities?
Compute the average score for each student rounded off : Write a C program roster.c that enters a class roster from a file roster.dat. The class roster contains records for some number of students.
What someone called the wide asleep listener : Is an attempt to be polite to someone during a conversation and results in what someone called the "wide asleep listener?
Write a c program which uses a structure type : Write a C program which uses a structure type that stores data records for a car, as described in the Requirements.
Aspect of the law would be both easy and challenging : Support your position with reasons why you believe the aspect of the law would be both easy and challenging.
Determine the market demand schedule on the assumption : On the basis of the three individual demand schedules in the following table and assuming these three people are the only ones in the society.
Harley-davidson based on relevant five-force analysis : The critical competitive forces in the motorcycle industry that may threaten Harley-Davidson based on a relevant five-force analysis.
Compute the unknown quantity and print the result : Take as input the values of the known quantities and compute the unknown quantity and print the result to the screen.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Create a slide on security center of excellence

Create a slide of risk management. Create a slide on security center of excellence and security framework (Security lifecycle, disaster recovery).

  Minimum size of instruction

An imaginary computer has the 16 data registers (R0 to R3), 1024 words in memory, and the 16 different instructions (add, subtract, etc.). Explain the minimum size of the instruction in bits.

  How to define a class named document

express a class named Document that contains an instance variable of type String named text that stores any textual content for the document. Create a method named toString that returns the text field and also include a method to set this value.

  Explain would you object to the given approach

She claims that you could also eliminate your SAN and connect the client computers directly to the disk array. Would you object to this approach? Explain.

  What role do the activities play as analysis strategies

Compare and contrast duration analysis and activity based costing. What role do these activities play as analysis strategies?

  Wap that can perform a caesar cipher

Using the Web or other resources, write a brief paper about RSA, its history, methodology, and where it is used. Students with a sufficient math background.

  The user for a positive number n representing the number

Write a C program called sort.c that first prompts the user for a positive number n representing the number of numbers to be sorted.

  Write a program of bisection method to approximate value

Write a program of Bisection method to approximate the value of x with an approximate relative error

  Write a script that prompts the user for a date

Use the code that reads a single character to ask the user to press a key indicating whether they want to compare to today or another date.

  Create a conceptual data modeling for the dataset

Using the identified dataset, create a conceptual data modeling for the dataset; you may use the software of your choice.

  What is the purpose of the database

Basic business rules need to be developed for cross-sales and up-sales. We will not worry about identifying the formulas for these recommendations.

  How to implement a stack using an array

How to implement a stack using an array. How to implement a stack using a linear, singly-linked list.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd