Starting Out with C++: Early Objects (9th Edition)
9th Edition
ISBN: 9780134400242
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 8.13, Problem 8.40CP
Write a structure declaration called Destination , with the following members: city, a string object
travelTime, a Measurement structure (declared in Checkpoint 8.39)
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Java Assignment
Outcomes:
Student will demonstrate the ability to utilize inheritance in a Java program.
Student will demonstrate the ability to apply the IS A and HAS A relationships.
Program Specifications:
Start by watching Video Segment 16 from Dr. Colin Archibald's video series (found in the module overview). Key in the program shown in the video and make sure it works.
Then, add the following:
Animals have a Weight.
Animals have a Height.
Dog is an Animal.
Dogs have a Name.
Dogs have a Breed.
Dogs have a DOB.
Cat is an Animal
Cats have a Name.
Cats have 9 lives, so you need to keep track of the remaining lives once a cat dies.
Bird is an Animal
Birds have a wing span
Birds have a canFly which is true or false (some birds cannot fly)
Create a test class that creates one of each type of animal and displays the animal’s toString method.
Submission Requirements:
You must follow the rules from the prior assignments. UMLs and Design Tools are not required for this one.
YOU MAY…
Object oriented programming C++
Use Classes
Write a C++ program in which each flight is required to have a date of departure, a time of departure, a date of arrival and a time of arrival. Furthermore, each flight has a unique flight ID and the information whether the flight is direct or not.Create a C++ class to model a flight. (Note: Make separate classes for Date and Time and use composition).add two integer data members to the Flight class, one to store the total number of seats in the flight and the other to store the number of seats that have been reserved. Provide all standard functions in each of the Date, Time and Flight classes (Constructors, set/get methods and display methods etc.).Add a member function delayFlight(int) in the Flight class to delay the flight by the number of minutes pass as input to this function. (For simplicity, assume that delaying a flight will not change the Date). Add a member function reserveSeat(int) which reserves the number of seats passed as…
Nutritional information (classes/constructors) PYTHON ONLY
Complete the FoodItem class by adding a constructor to initialize a food item. The constructor should initialize the name (a string) to "None" and all other instance attributes to 0.0 by default. If the constructor is called with a food name, grams of fat, grams of carbohydrates, and grams of protein, the constructor should assign each instance attribute with the appropriate parameter value.
The given program accepts as input a food item name, fat, carbs, and protein and the number of servings. The program creates a food item using the constructor parameters' default values and a food item using the input values. The program outputs the nutritional information and calories per serving for both food items.
Ex: If the input is:
M&M's10.034.02.01.0
where M&M's is the food name, 10.0 is the grams of fat, 34.0 is the grams of carbohydrates, 2.0 is the grams of protein, and 1.0 is the number of servings, the output is:…
Chapter 8 Solutions
Starting Out with C++: Early Objects (9th Edition)
Ch. 8.3 - Define the following arrays: A) empNum, a 100...Ch. 8.3 - Prob. 8.2CPCh. 8.3 - Prob. 8.3CPCh. 8.3 - Assume a program includes the following two...Ch. 8.3 - What is array bounds checking? Does C++ perform...Ch. 8.3 - What is the output of the following code? int...Ch. 8.3 - Complete the following program skeleton so it will...Ch. 8.7 - Define the following arrays: A) ages, a 10-element...Ch. 8.7 - Indicate if each of the following array...Ch. 8.7 - Prob. 8.10CP
Ch. 8.7 - Given the following array definition: int values...Ch. 8.7 - Prob. 8.12CPCh. 8.7 - Prob. 8.13CPCh. 8.7 - What is the output of the following code? const...Ch. 8.9 - Write a typedef statement that makes the name...Ch. 8.9 - Prob. 8.16CPCh. 8.9 - What is the output of the following program...Ch. 8.9 - The following program segments, when completed,...Ch. 8.11 - Prob. 8.19CPCh. 8.11 - Prob. 8.20CPCh. 8.11 - Prob. 8.21CPCh. 8.11 - Prob. 8.22CPCh. 8.11 - Prob. 8.23CPCh. 8.11 - Fill in the empty table below so it shows the...Ch. 8.11 - Write a function called displayArray7. The...Ch. 8.11 - Prob. 8.26CPCh. 8.12 - Prob. 8.27CPCh. 8.12 - Write definition statements for the following...Ch. 8.12 - Define gators to be an empty vector of ints and...Ch. 8.13 - True or false: The default constructor is the only...Ch. 8.13 - True or false: All elements in an array of objects...Ch. 8.13 - What will the following program display on the...Ch. 8.13 - Complete the following program so that it defines...Ch. 8.13 - Add two constructors to the Product structure...Ch. 8.13 - Prob. 8.35CPCh. 8.13 - Prob. 8.36CPCh. 8.13 - Prob. 8.37CPCh. 8.13 - Write the definition for an array of five Product...Ch. 8.13 - Write a structure declaration called Measurement...Ch. 8.13 - Write a structure declaration called Destination ,...Ch. 8.13 - Define an array of 20 Destination structures (see...Ch. 8 - The ________ indicates the number of elements, or...Ch. 8 - The size declarator must be a(n) _______ with a...Ch. 8 - Prob. 3RQECh. 8 - Prob. 4RQECh. 8 - The number inside the brackets of an array...Ch. 8 - C++ has no array ________ checking, which means...Ch. 8 - Prob. 7RQECh. 8 - If a numeric array is partially initialized, the...Ch. 8 - If the size declarator of an array definition is...Ch. 8 - Prob. 10RQECh. 8 - Prob. 11RQECh. 8 - Prob. 12RQECh. 8 - Arrays are never passed to functions by _______...Ch. 8 - To pass an array to a function, pass the ________...Ch. 8 - A(n) ________ array is like several arrays of the...Ch. 8 - Its best to think of a two -dimensional array as...Ch. 8 - Prob. 17RQECh. 8 - Prob. 18RQECh. 8 - When a two -dimensional array is passed to a...Ch. 8 - When you pass the name of an array as an argument...Ch. 8 - Look at the following array definition. int values...Ch. 8 - Given the following array definition: int values...Ch. 8 - Prob. 23RQECh. 8 - Assume that array1 and array2 are both 25-element...Ch. 8 - Prob. 25RQECh. 8 - How do you establish a parallel relationship...Ch. 8 - Look at the following array definition. double...Ch. 8 - Prob. 28RQECh. 8 - Prob. 29RQECh. 8 - Prob. 30RQECh. 8 - Prob. 31RQECh. 8 - The following code totals the values in each of...Ch. 8 - Prob. 33RQECh. 8 - Prob. 34RQECh. 8 - In a program you need to store the identification...Ch. 8 - Prob. 36RQECh. 8 - Prob. 37RQECh. 8 - Prob. 38RQECh. 8 - Each of the following functions contains errors....Ch. 8 - Soft Skills Diagrams are an important means of...Ch. 8 - Perfect Scores 1. Write a modular program that...Ch. 8 - Larger Than n Create a program with a function...Ch. 8 - Roman Numeral Converter Write a program that...Ch. 8 - Chips and Salsa Write a program that lets a maker...Ch. 8 - Monkey Business A local zoo wants to keep track of...Ch. 8 - Rain or Shine An amateur meteorologist wants to...Ch. 8 - Lottery Write a program that simulates a lottery....Ch. 8 - Rainfall Statistics Write a modular program that...Ch. 8 - Lo Shu Magic Square The Lo Shu Magic Square is a...Ch. 8 - Baseball Champions This challenge uses two files...Ch. 8 - Chips and Salsa Version 2 Revise Programming...Ch. 8 - Stats Class and Rainfall Statistics Create a Stats...Ch. 8 - Stats Class and Track Statistics Write a client...Ch. 8 - Prob. 14PCCh. 8 - Drivers License Exam The State Department of Motor...Ch. 8 - Array of Payro11 Objects Design a PayRoll class...Ch. 8 - Drink Machine Simulator Create a class that...Ch. 8 - Bin Manager Class Design and write an object...Ch. 8 - Tic-Tac-Toe Game Write a modular program that...Ch. 8 - Theater Ticket Sales Create a TicketManager class...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
3.12 (Date Create a class called Date that includes three pieces Of information as data
members—a month (type ...
C++ How to Program (10th Edition)
Modify the code you wrote in Question 18 so it adds all of the numbers read from the file and displays their to...
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Practice Problem 12.3 (solution page 1036) In Linux systems, typing Ctrl+D indicates EOF on standard input. Wha...
Computer Systems: A Programmer's Perspective (3rd Edition)
What is a potential error that can occur when a file is opened for reading?
Starting Out with Java: From Control Structures through Objects (6th Edition)
List the components of a database.
Database Concepts (8th Edition)
What are the design issues for character string types?
Concepts Of Programming Languages
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Please do it in JavaScript or C# 1) Design and implement the class structure for a drawing application. A drawing is made up of a canvas that contains a collection of three different shapes: circles, lines, and boxes. Each shape can be drawn by calling a Draw() method for that shape. The canvas class should also have a draw method that draws all of the shapes it contains. You don’t have to actually draw anything on a screen; you can simulate drawing by writing a message to the console.For example, the code snippet: canvas.Draw();Drawing a circle at...Drawing a line at...etc. (For each shape on the canvas) 2)(Bonus) Consider re-writing the above answer (#1) differently where the canvas does not contain the shapes, but is able to draw any of the three shapes passed to it. Re-design canvas.Draw() if you need to. Your main() program should ask for user input on what shape to draw. Ask once, draw, then exit.could produce something like the following output to the console:arrow_forwardAssignment 7 B: Battle! Language is in C++ (pictures include the sample output) Recreate a basic battle system from a video game. You will create a character and then use it to battle a computer generated opponent. There are three possible classes, with the following attributes: Sword Fighter Dance BattlerHP: 120Attack: 40Defense: 0.20ClassID: 1 Unicorn SorcererHP: 80Attack: 35Defense: 0.60ClassID: 2 Dance BattlerHP: 100Attack: 20Defense: 0.42ClassID: 3 You will create a NPC class that has these three attribute. It should also have an attribute for Name.You will then create the following methods in the NPC class: A constructor that takes in a Name string and a ClassID int. It should use the value of the ClassID to assign values to the other attributes (using the chart above) Getter methods for all five attributes, and a Setter method for HP that subtractsthe object’s HP by the value passed in. calculateAttack◦ This method returns a float value. It takes in a float that represents…arrow_forwardAssignment 7 B: Battle! Language is in C++ (pictures include the sample output) Recreate a basic battle system from a video game. You will create a character and then use it to battle a computer generated opponent. There are three possible classes, with the following attributes: Sword Fighter Dance BattlerHP: 120Attack: 40Defense: 0.20ClassID: 1 Unicorn SorcererHP: 80Attack: 35Defense: 0.60ClassID: 2 Dance BattlerHP: 100Attack: 20Defense: 0.42ClassID: 3 You will create a NPC class that has these three attribute. It should also have an attribute for Name.You will then create the following methods in the NPC class: A constructor that takes in a Name string and a ClassID int. It should use the value of the ClassID to assign values to the other attributes (using the chart above) Getter methods for all five attributes, and a Setter method for HP that subtractsthe object’s HP by the value passed in. calculateAttack◦ This method returns a float value. It takes in a float that represents…arrow_forward
- Object-Oriented Programming - Java programming.arrow_forwardImplement the following hierarchy using C++ classes. 1. Shape: This should be an interface class that supports area() and display() functions. 2. Circle and Rectangle: Implement the area and display functions of Shape. 3. Quadrilateral: This class should be an abstract class. It may contain member variables for length and height. 4. Trapezoid: Should inherit length, height from Quadrilateral, and add 'side', represents the side parallel to 'length'. 5. Create appropriate .h/.cpp files with constructors and destructors (wherever needed). which 6-arrow_forwardWhat do the terms "static data member" and "static memberfunction" mean to you? wwwarrow_forward
- help me javaarrow_forwardclass Airplane – highlights -- planeID : String -planeModel: String //”Boeing 757” etc. --seatCapacity : int //would vary by outfitting ………… Assume getters and setters, toString(), constructor with parameters and constructor ……………… Write lambdas using a standard functional interface to: a) Given a plane object and a required number of seats as an input, determine if the given plane meets or exceeds the required capacity b) Output the plane description if capacity is less than 80% of a specified number (We would use his for planning aircraft assigned to various routes. ) c) Adjust the seats in a plane by a specified positive or negative number [after modifications have been made to the interior.] …and write an example for each showing the usage, using an Airplane instance plane1arrow_forwardjava programming language You are part of a team writing classes for the different game objects in a video game. You need to write classes for the two human objects warrior and politician. A warrior has the attributes name (of type String) and speed (of type int). Speed is a measure of how fast the warrior can run and fight. A politician has the attributes name (of type String) and diplomacy (of type int). Diplomacy is the ability to outwit an adversary without using force. From this description identify a superclass as well as two subclasses. Each of these three classes need to have a default constructor, a constructor with parameters for all the instance variables in that class (as well as any instance variables inherited from a superclass) accessor (get) and mutator (set) methods for all instance variables and a toString method. The toString method needs to return a string representation of the object. Also write a main method for each class in which that class is tested – create…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Structured Chart; Author: Tutorials Point (India) Ltd.;https://www.youtube.com/watch?v=vdUO-sGA1DA;License: Standard YouTube License, CC-BY
Introduction to Structure Charts; Author: Christopher Kalodikis;https://www.youtube.com/watch?v=QN2bjNplGlQ;License: Standard Youtube License