Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
7th Edition
ISBN: 9780134802213
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 6, Problem 2MC
A class is analogous to a(n) _______.
- a. house
- b. blueprint
- c. drafting table
- d. architect
Expert Solution & Answer
Learn your wayIncludes step-by-step video
schedule04:15
Students have asked these similar questions
Develop a set of classes for a college to use in various student service and personnel applications. Classes you need to design include the following:
•• Person—A Person contains a first name, last name, street address, zip code, and phone number. The class also includes a method that sets each data field, using a series of dialog boxes and a display method that displays all of a Person’s information on a single line at the command line on the screen.
•• CollegeEmployee—CollegeEmployee descends from Person. A CollegeEmployee also includes a Social Security number, an annual salary, and a department name, as well as methods that override the Person methods to accept and display all CollegeEmployee data.
•• Faculty—Faculty descends from CollegeEmployee. This class also includes a Boolean field that indicates whether the Faculty member is tenured, as well as methods that override the CollegeEmployee methods to accept and display this additional piece of information.
•• Student—Student…
#this is a python program
#topic: OOP
Design the Country class so that the code gives the expected output. [You are not allowed to change the code below]
# Write your Class Code here
country = Country()
print('Name:',country.name)
print('Continent:',country.continent)
print('Capital:',country.capital)
print('Fifa Ranking:',country.fifa_ranking) print('===================')
country.name = “Belgium”
country.continent = “Europe”
country.capital = “Brussels”
country.fifa_ranking = 1
print('Name:',country.name)
print('Continent:',country.continent)
print('Capital:',country.capital)
print('Fifa Ranking:',country.fifa_ranking)
Output:
Name: Bangladesh
Continent: Asia
Capital: Dhaka
Fifa Ranking: 187
===================
Name: Belgium
Continent: Europe
Capital: Brussels
Fifa Ranking: 1
Thanks In Advance, and i apperciate the quicknresponse.
Q1. Design a class named Car that has the following fields
Design a Class You’ll design a class named Car that has the following fields: yearModel—An Integer that holds the car’s model year make—A String that holds the make of the car speed—An Integer that holds the car’s current speed The class should have the following constructor and other methods: The constructor should accept the car’s model year and make as arguments. These values should be assigned to the object’s yearModel and make fields. The constructor should also assign 0 to the speed field. Design appropriate accessor methods to get the values stored in an object’s yearModel, make, and speed fields. The accelerate method should add 5 to the speed field each time it’s called. The brake method should subtract 5 from the speed field each time it’s called.
Part 2: Design a Program You’ll create both pseudocode and a flowchart to design a program that creates a Car…
Chapter 6 Solutions
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Ch. 6.1 - What does an object use its fields for?Ch. 6.1 - Prob. 6.2CPCh. 6.1 - How is a class like a blueprint?Ch. 6.1 - You have programs that create Scanner, Random, and...Ch. 6.1 - Prob. 6.5CPCh. 6.1 - What values do reference variables hold?Ch. 6.1 - Prob. 6.7CPCh. 6.2 - You hear someone make the following comment: A...Ch. 6.2 - Prob. 6.9CPCh. 6.2 - When a variable is said to reference an object,...
Ch. 6.2 - Prob. 6.11CPCh. 6.2 - Prob. 6.12CPCh. 6.2 - Prob. 6.13CPCh. 6.2 - Prob. 6.14CPCh. 6.2 - Prob. 6.15CPCh. 6.2 - What is a stale data item?Ch. 6.3 - Assume that r1 and r2 are variables that reference...Ch. 6.4 - How is a constructor named?Ch. 6.4 - What is a constructors return type?Ch. 6.4 - Prob. 6.20CPCh. 6.7 - Prob. 6.21CPCh. 6.7 - What is a methods signature?Ch. 6.7 - Look at the following class: public class...Ch. 6.7 - How many default constructors may a class have?Ch. 6.9 - Prob. 6.25CPCh. 6.9 - When designing an object-oriented application, who...Ch. 6.9 - How do you identify the potential classes in a...Ch. 6.9 - What are a classs responsibilities?Ch. 6.9 - What two questions should you ask to determine a...Ch. 6.9 - Will all of a classs actions always be directly...Ch. 6 - This is a collection of programming statements...Ch. 6 - A class is analogous to a(n) _______. a. house b....Ch. 6 - An object is a(n) ________. a. blueprint b....Ch. 6 - This is a class member that holds data. a. method...Ch. 6 - This key word causes an object to be created in...Ch. 6 - This is a method that gets a value from a classs...Ch. 6 - This is a method that stores a value in a field or...Ch. 6 - When the value of an item is dependent on other...Ch. 6 - This is a method that is automatically called when...Ch. 6 - When a local variable has the same name as a...Ch. 6 - This is automatically provided for a class if you...Ch. 6 - Prob. 12MCCh. 6 - Prob. 13MCCh. 6 - A classs responsibilities are __________. a. the...Ch. 6 - True or False: The new operator creates an...Ch. 6 - True or False: Each instance of a class has its...Ch. 6 - True or False: When you write a constructor for a...Ch. 6 - True or False: A class may not have more than one...Ch. 6 - True or False: To find the classes needed for an...Ch. 6 - Find the error in the following class: public...Ch. 6 - Prob. 2FTECh. 6 - The following statement attempts to create a...Ch. 6 - Find the error in the following class: public...Ch. 6 - Find the error in the following class: public...Ch. 6 - Design a class named Pet, which should have the...Ch. 6 - Look at the following partial class definition,...Ch. 6 - Consider the following class declaration: public...Ch. 6 - Look at the following description of a problem...Ch. 6 - The bank offers the following types of accounts to...Ch. 6 - Assume that you are writing an application that...Ch. 6 - What is the difference between a class and an...Ch. 6 - A contractor uses a blueprint to build a set of...Ch. 6 - What is an accessor method? What is a mutator...Ch. 6 - is it a good idea to make fields private? Why or...Ch. 6 - If a class has a private field, what has access to...Ch. 6 - Prob. 6SACh. 6 - Assume a program named MailList.java is stored in...Ch. 6 - Why are constructors useful for performing...Ch. 6 - Under what circumstances does Java automatically...Ch. 6 - What do you call a constructor that accepts no...Ch. 6 - Prob. 11SACh. 6 - How does method overloading improve the usefulness...Ch. 6 - Employee Class Write a class named Employee that...Ch. 6 - Car Class Write a class named Car that has the...Ch. 6 - Personal Information Class Design a class that...Ch. 6 - Retail Item Class Write a class named RetailItem...Ch. 6 - Payroll Class Design a Payroll class that has...Ch. 6 - TestScores Class Design a TestScores class that...Ch. 6 - Circle Class Write a Circle class that has the...Ch. 6 - Temperature Class Write a Temperature class that...Ch. 6 - Days in a Month Write a class named MonthDays, The...Ch. 6 - A Game of Twenty-One For this assignment, you will...Ch. 6 - Freezing and Boiling Points The following table...Ch. 6 - SavingsAccount Class Design a SavingsAccount class...Ch. 6 - Deposit and Withdrawal Files Use Notepad or...Ch. 6 - Patient Charges Write a class named Patient that...Ch. 6 - Dice Game Write a program that uses the Die class...Ch. 6 - Roulette Wheel Colors On a roulette wheel, the...Ch. 6 - Coin Toss Simulator Write a class named Coin. The...Ch. 6 - Tossing Coins for a Dollar For this assignment you...Ch. 6 - Fishing Game Simulation For this assignment, you...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
The ________ object is assumed to exist and it is not necessary to include it as an object when referring to it...
Web Development and Design Foundations with HTML5 (8th Edition)
Figure 4-3212 shows a class list for Millennium College. Convert this user view to a set of 3NF relations using...
Modern Database Management (12th Edition)
Repair Bill Suppose automobile repair customers are billed at the rate of per hour for labor. Also, suppose co...
Introduction To Programming Using Visual Basic (11th Edition)
Why is the study of database technology important?
Database Concepts (8th Edition)
The concept of seniority, which some employers use to hire and fire workers is _____. a.a stack b.a queue c.a l...
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
A file that contains a Flash animation uses the __________ file extension. a. .class b. .swf c. .mp3 d. .flash
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
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
- Create a class Car with parameters companyName, color, maxSpeed (Not more than 150) andcategory. Use appropriate data types and access specifiers. Use default constructor to create objectsof cars. (JAVA)arrow_forwardI need help with this PLEASE NO JAVA NO C++ ONLY PYTHON PLZ Create a class object with the following attributes and actions: Class Name Class number Classroom Semester Level Subject Actions: Store a class list Print the class list as follows: Class name Class Number Semester Level Subject Test your object: Ask the user for all the information and to enter at least 3 classes test using all the actions of the object print using the to string action Describe the numbers and text you print. Do not just print numbers or strings to the screen explain what each number represents.arrow_forwardTHIS NEEDS TO BE DONE IN JAVA! Create a class called Employee that includes three instance variables—a first name (type String), a last name (type String) and a monthly salary (double). Provide a constructor that initializes the three instance variables. Provide a set and a get method for each instance variable. If the monthly salary is not positive, do not set its value. Write a test app named EmployeeTest that demonstrates class Employee’s capabilities. Create two Employee objects and display each object’s yearly salary. Then give each Employee a 10% raise and display each Employee’s yearly salary again.arrow_forward
- Create a car rental system where customers rent cars for a given period of time. You are given the following classes: Car– a class that has the following properties: car type: Mrcedes, Opel, Fiat, ....etc.. car license end date. car number. Necessary constructor and getters/setters. Small car class– inherits from the car and has the following constants: 4 passengers, Motor 1200, air-conditioner. Medium car class– inherits from the car and has the following constants: 4 passengers, Motor 1400, air-conditioner, Speed Control. Large car class- inherits from car and has the following constants: 6 passengers, Motor 1600, air-conditioner, speed control, Wi-Fi. Customer class: holds first name, last name and id number as member variables (of course with necessary constructor, getters and setters) . Rent class (representing the time period when the car is rent): holds startDate and endDate, rent price (of course with necessary constructor, getters and setters). In…arrow_forward(PYTHON) (The Rectangle class) Following the example of the Circle class in Section 7.2, design a class named Rectangle to represent a rectangle. The class contains: Two data fields named width and height. A constructor that creates a rectangle with the specified width and height. The default values are 1 and 2 for the width and height, respectively. A method named getArea() that returns the area of this rectangle. A method named getPerimeter() that returns the perimeter. Draw the UML diagram for the class, and then implement the class. Write a test program that creates two Rectangle objects—one with width 4 and height 40 and the other with width 3.5 and height 35.7. Display the width, height, area, and perimeter of each rectangle in this order.arrow_forwardChoose necessary patters, draw the UML and code just company class methods on paper. A car company makes a car produce application. There are diffrerent types of models that the company builds as sedan and sport. Each model has some shared and distinguishing features. The object creation process should conduct by a central class. The second central class should not be created in the application.arrow_forward
- Step 2: Identify three different classes that might contain each of these objects: myBlueDenimShirt presidentOfTheUnitedStates myPetCat myCousinJimbo This is about programming and understanding the difference about objects and class. Thanksarrow_forwardCreate an Inventory class named, Inventory.cpp, that can hold information and calculatedata for items in a retail store’s inventory.The class should have the following private member variables:Variable Name DescriptionitemNumber An integer that holds the item’s item number.quantity An integer for holding the quantity of the items on hand.cost A double for holding the wholesale per-unit cost of the itemtotalCost A double for holding the total inventory cost of the item(calculated as quantity times cost).The class should have the following public member functions:Member Function DescriptionDefault Constructor Sets all the member variables to 0.Constructor #2 Accepts an item’s number, cost, and quantity as arguments.The function should copy these values to the appropriatemember variables.setItemNumber Accepts an integer argument that is copied to theitemNumber member variable.setQuantity Accepts an integer argument that is copied to the quantitymember variable.setCost Accepts a double…arrow_forwardCreate an Inventory class named, Inventory.cpp, that can hold information and calculatedata for items in a retail store’s inventory.The class should have the following private member variables:Variable Name DescriptionitemNumber An integer that holds the item’s item number.quantity An integer for holding the quantity of the items on hand.cost A double for holding the wholesale per-unit cost of the itemtotalCost A double for holding the total inventory cost of the item(calculated as quantity times cost).The class should have the following public member functions:Member Function DescriptionDefault Constructor Sets all the member variables to 0.Constructor #2 Accepts an item’s number, cost, and quantity as arguments.The function should copy these values to the appropriatemember variables.setItemNumber Accepts an integer argument that is copied to theitemNumber member variable.setQuantity Accepts an integer argument that is copied to the quantitymember variable.setCost Accepts a double…arrow_forward
- Create an Inventory class named, Inventory.cpp, that can hold information and calculatedata for items in a retail store’s inventory.The class should have the following private member variables:Variable Name DescriptionitemNumber An integer that holds the item’s item number.quantity An integer for holding the quantity of the items on hand.cost A double for holding the wholesale per-unit cost of the itemtotalCost A double for holding the total inventory cost of the item(calculated as quantity times cost).The class should have the following public member functions:Member Function DescriptionDefault Constructor Sets all the member variables to 0.Constructor #2 Accepts an item’s number, cost, and quantity as arguments.The function should copy these values to the appropriatemember variables.setItemNumber Accepts an integer argument that is copied to theitemNumber member variable.setQuantity Accepts an integer argument that is copied to the quantitymember variable.setCost Accepts a double…arrow_forward(already solved on bartleby) You are required to build a mini FunTime application for the kids to playwith their electronic toys in a virtual world. Follow the given steps Build a class Toy having the following data members Name(String) Color (String) Type (String) Price (float) batteryHealth (int) Provide constructor with arguments for name, color, type, and price. Initialize batteryHealth to 5 (which means full). Provide getter for each of these but no setters. Provide a function charge(String time). This function would increase the batteryHealth of the toy according to following rules Time Increase in battery health 15 mins 20% charging (Increase health by 1) 30 mins 40% 45 mins 60% 1 hour 80% 1 hour 15 mins 100% If the toy is already fully charged, then no more charging should be done and appropriate message to be displayed. The charge function returns the new health of the battery of toy object. Provide another function play() that reduces the…arrow_forwardEncircle/ write down the correct/missing code.Elaborate if needed by writing a comment with a blue font color. public class Main { public static void main (String[] args) { double price; price 320.00; scanner Jann = new scanner(System.in) System.out.println("How many items are you buying?"); int number = Jann.nextint(); int total = price * number; System.out.println("Your total payment is" + " " + total) } } //this is a subclass of superclass Teacher public class ScienceTeacher { Public final boolean ScienceMajor; Science (String ScienceMajor, String name, String age){ this.ScienceMajor= ScienceMajor; super(name, age); } }arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Memory Management Tutorial in Java | Java Stack vs Heap | Java Training | Edureka; Author: edureka!;https://www.youtube.com/watch?v=fM8yj93X80s;License: Standard YouTube License, CC-BY