Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++... Assignment 3 is two programs. The first will demonstrate Pointers including Pointer Arithmetic and the second will demonstrate a simple structure. This assignment

In C++...

Assignment 3 is two programs. The first will demonstrate Pointers including Pointer Arithmetic and the second will demonstrate a simple structure. This assignment is for this week and next week (posted here together to have it all in one place and one link.)

[Most of the assignments will be about a set of Cars. That will be the situation we will be keeping data for and we will be recycling a car class as our complex data type once we get to it. This is the first assignment that is using our data set we will be using for this class. Thats why there are 6 arrays and not one for the assignment.]

Program 1 (50 Points) - Chapter 9

1) Create the following car data in parallel arrays (set these values with an initialization list or otherwise set the values inside the program.) You may also use parallel vectors if you would like. It is up to you. Make Model Color Year Mileage VIN 1. Porsche 911 Silver 2005 18990 1237362 2. Ford Mustang Red 2007 49842 7337372 3. Chevrolet Beretta Black 1989 90332 2873644 4. Ford Focus White 2008 150 9236498 5. Voltzwagon Jetta Black 2006 28002 4673992 6. Rolls Royce Ghost Silver 2005 10000 9292983 7. Mazda 626 Blue 2002 84754 7364646 8. Toyota Camry Red 2004 50332 2133737 9. <>

2) Set a pointer to each of the arrays that hold the information on the sample items in inventory. Demonstrate pointer arithmetic (page 508-511) by writing a loop that prints out all of the values in the Car arrays for the user and uses the pointers and pointer arithmetic 3) Ask the user for a value to change for a car in the array (for a part of a car you choose like color or year) and change that value through a pointer. Ask the user for a value to change for a different car in the array (for a part of a car you choose like color or year) and change that value through a pointer.

4) Redisplay the array to show the values in the current set of car data by using pointers, and pointer arithmetic to see the two changed values.

Program 2 (50 Points) - Chapter 11 covered next week

Create a program with a main() to be used by the inventory manager to keep track of all of the cars on the lot.

1) Create a struct for a Car. This new struct should have variables inside it to hold Make, Model, Color, Year, Mileage, and VIN. (Page 602 has an example of one for PayRoll if you need one to go by. It has 5 internal variables, yours for the Car will have 6.)

2) Create the following car data in one array of your Car structure (set these values with an initialization list or otherwise set the values inside the program.) You may also use a vector of the new Car structure if you would like. In either case you should have one and only one array (or vector) that holds all of the information below as each element in it is an entire cars data:

Make Model Color Year Mileage VIN

1. Porsche 911 Silver 2005 18990 1237362

2. Ford Mustang Red 2007 49842 7337372

3. Chevrolet Beretta Black 1989 90332 2873644

4. Ford Focus White 2008 150 9236498

5. Voltzwagon Jetta Black 2006 28002 4673992

6. Rolls Royce Ghost Silver 2005 10000 9292983

7. Mazda 626 Blue 2002 84754 7364646

8. Toyota Camry Red 2004 50332 2133737

9. <>

2) Write a loop to display all of the car data inside the array for the user.

3) Write the code to ask the user for a car position to change, and then ask the user for the year and mileage to change the car data in that position to. Change the values of this car and redisplay the cars for the user to show the change to the structure at that position in your array.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

Students also viewed these Databases questions

Question

Prepare a short profile of victor marie hugo ?

Answered: 1 week ago

Question

Prepare a short profile of Henry words worth Longfellow?

Answered: 1 week ago

Question

What is RAM as far as telecommunication is concerned?

Answered: 1 week ago

Question

Question 1: What is reproductive system? Question 2: What is Semen?

Answered: 1 week ago