Question
Asked Nov 25, 2019
1 views

Write a c++ program

 

The above figure represents relationships between different struct variables as described in the following narrations: OnRoad is Company struct variable. Amy, Sammy, and Terry are name variables of Driver structs. As depicted, Company struct has six components. The Driver struct has three components. In your program you need to create all structs variables, make appropriate dereferencing (pointer connection), and display drivers' names using OnRoad variable. Expected output is the following:

OnRoad's first driver is Amy.
OnRoad's second driver is Sammy.
OnRoad's third driver is Terry.

 

Requirements:

 - Driver structures should be created with "new" keyword.

 - Three Driver pointer types (of Company Struct) should be individual variables, not array.

 

OnRoad
Name
DL
СЕО
HoursPerWeek
Address
NumOfEmp
Driver
Name
Driver
DL
Driver
HoursPerWeek
Name
DL
HoursPerWeek
help_outline

Image Transcriptionclose

OnRoad Name DL СЕО HoursPerWeek Address NumOfEmp Driver Name Driver DL Driver HoursPerWeek Name DL HoursPerWeek

fullscreen
check_circle

Expert Answer

Step 1

Program:

#include<iostream>

#include<string>

 

using namespace std;

 

struct Driver

{

  string Name;

  string DL;

  int HoursPerWeek;

};

 

struct OnRoad

{

  string CEO;

  string Address;

  int NumOfEmp;

 

  Driver* firstDriver;

  Driver* secondDriver;

  Driver* thirdriver;

};

 

int main()

{

  OnRoad onRoad;

  onRoad.CEO = "William";

  onRoad.Address = "No.2 North Street";

  onRoad.NumOfEmp = 3;

 

  onRoad.firstDriver = new Driver{"Amy" , "DL256985" , 8};

  onRoad.secondDriver = ...

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in

Engineering

Computer Science

Related Computer Science Q&A

Find answers to questions asked by student like you
Show more Q&A
add
question_answer

Q: Describe the tools and technology used to support IT project management. What are the characteristic...

A: IT Project Management is a method for organizing the information technology development program, org...

question_answer

Q: Use function GetUserInfo to get a user's information. If user enters 20 and Holly, sample program ou...

A: Completing the given C++ program so, that it can follow the given rubrics:In the main function, call...

question_answer

Q: How often does garbage collection run on a DC? Group of answer choices 2 hours 6 hours 12 hours...

A: The process of garbage collection is designed to free up space within the AD database. Whenever an o...

question_answer

Q: Firewall rules in Windows flow in which direction(s)?Group of answer choices Either inbound or outbo...

A: Firewall rulesFirewall rules in windows flows both inbound and outbound directions. An inbound firew...

question_answer

Q: Find the employment age of each employee?

A: Select empno, ename datediff(YY,hiredate ,getdate()) as emp from emp; The above query prints the emp...

question_answer

Q: Write a loop that sets each array element to the sum of itself and the next element, except for the ...

A: Completing the given C++ program so, that it can follow the given rubrics:Firstly, displaying a mess...

question_answer

Q: Too Many Networks While attempting to connect to the wireless network at your job, you notice that f...

A: Selecting the appropriate wireless network:The user can determine the wireless network to which he/s...

question_answer

Q: Can two network interfaces have the same MAC address? Why or why not? Also, can two network interfac...

A: This question is based on network interfaces of the computer system and IP address. So, first let’s ...

question_answer

Q: What is the SQL command to change the BEST_SELLER column in the MYSTERY table to reject nulls (table...

A: Below is the SQL command to create the table MYSTERY.In the given SQL statement NOT NULL constraint ...