Java Programming (MindTap Course List)
9th Edition
ISBN: 9781337397070
Author: Joyce Farrell
Publisher: Cengage Learning
expand_more
expand_more
format_list_bulleted
Question
thumb_up100%
Chapter 4, Problem 11PE
Program Plan Intro
Wedding details
Program plan:
Filename: “Person.java”
- Define the “Person” class
- Declare the member variables.
- Define the constructor
- Set the values.
- Define the “getFirstName” method
- Return the first name
- Define the “getLastName” method
- Return the last name
- Define the “getBirthDate” method
- Return the birth day
Filename: “Couple.java”
- Define the “Couple” class
- Declare the member variables.
- Define the constructor
- Set the values.
- Define the “getFirstPerson” method
- Return the first person name
- Define the “getSecondPerson” method
- Return the second person name
Filename: “Wedding.java”
- Define the “Wedding” class
- Declare the member variables.
- Define the constructor
- Set the values.
- Define the “getWeddingDate” method
- Return the wedding date
- Define the “getCouple” method
- Return the couple
- Define the “getLocation” method
- Return the location
Filename: “TestWedding.java”
- Define the “TestWedding” class
- Declare the variable for “SimpleDateFormat”.
- Create the objects for “Person” class
- Display the wedding details.
- Define the main method
- Create the objects for “Person” class
- Create an object for “Couple” class
- Create an object for “Wedding” class
- Call the “displayWedding” method with an argument
- Create the objects for “Person” class
- Create an object for “Couple” class
- Create an object for “Wedding” class
- Call the “displayWedding” method with an argument.
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
Design a Ship class that the following members:
A field for the name of the ship (a string).
A field for the year that the ship was built (a string).
A constructor and appropriate accessors and mutators.
A toString method that displays the ship’s name and the year it was built.
Design a CruiseShip class that extends the Ship class. The CruiseShip class should have the following members:
A field for the maximum number of passengers (an int).
A constructor and appropriate accessors and mutators.
A toString method that overrides the toString method in the base class. The CruiseShip class’s toString method should display only the ship’s name and the maximum number of passengers.
Design a CargoShip class that extends the Ship class. The CargoShip class should have the following members:
A field for the cargo capacity in tonnage (an int).
A constructor and appropriate accessors and mutators.
A toString method that overrides the toString method in the base class. The…
Design a Book class that holds the title, author’s name, and price of the book. Books’s constructor
should initialize all of these data members except the price which is set to 500/-. Create a display
method that displays all fields.
All Books are priced at 500/- unless they are PopularBooks. The PopularBooks subclass replaces the Bookprice and sets each Book’s price to 50,000/- through PopularBooks construcor. Override the display method to display all fields.
Write a Main () method that declares an array of five Book objects. Ask the user to enter the title and author for each of the 5 Books. Consider the Book to be a PopularBook if the author is one of the following: Khaled Hosseini, Oscar Wilde, or Rembrandt. Display the five Books’ details.
c sharp
Create a class named Ship that has two private fields one for the name (string)of the ship, and the other for the year (string) the ship was built. The classcontains a parameterized constructor to set the values of each field get methods for each of the fields display method to display ship’s information.Create a class named CruiseShip that extends Ship class. CruiseShip class should have a private field for the maximum number of passengers (int).The class contains- a parameterized constructor to set the value of the field- get and set method for the field- a display method that overrides ship class display method anddisplay CruiseShip information.Create an application/class named CruiseShipDemo that allows a user toenter values to create 5 CruiseShip objects and save them in the array. Display the records.The CruiseShipDemo class should have a method named update to updatethe CruiseShips information. The method prompts the user for the ship name, if the requested record does not…
Chapter 4 Solutions
Java Programming (MindTap Course List)
Ch. 4 - Prob. 1RQCh. 4 - Prob. 2RQCh. 4 - Prob. 3RQCh. 4 - Prob. 4RQCh. 4 - Prob. 5RQCh. 4 - Prob. 6RQCh. 4 - Prob. 7RQCh. 4 - Prob. 8RQCh. 4 - Prob. 9RQCh. 4 - Prob. 10RQ
Ch. 4 - Prob. 11RQCh. 4 - Prob. 12RQCh. 4 - Prob. 13RQCh. 4 - Prob. 14RQCh. 4 - Prob. 15RQCh. 4 - Prob. 16RQCh. 4 - Prob. 17RQCh. 4 - Prob. 18RQCh. 4 - Prob. 19RQCh. 4 - Prob. 20RQCh. 4 - Prob. 1PECh. 4 - Prob. 2PECh. 4 - Prob. 3PECh. 4 - Prob. 4PECh. 4 - Prob. 5PECh. 4 - Prob. 6PECh. 4 - Prob. 7PECh. 4 - Prob. 8PECh. 4 - Prob. 9PECh. 4 - Prob. 10PECh. 4 - Prob. 11PECh. 4 - Prob. 1GZCh. 4 - Prob. 2GZ
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
- Design a Ship class that has the following members:a. A field for the name of the ship (a string).b. A field for the year that the ship was built (a string).c. A constructor and appropriate accessors and mutators.d. A toString method that displays the ship's name and the year it was built.Design a CruiseShip class that extends the Ship class. The CruiseShip class should have the following members:a. A field for the maximum number of passengers (an int).b. A constructor and appropriate accessors and mutators.c. A toString method that overrides the toString method in the base class. The CruiseShip class's toString method should display only the ship's name and the maximumnumber of passengers.Design a CargoShip class that extends the Ship class. The CargoShip class should have the following members:a. A field for the cargo capacity in tonnage (an int).b. A constructor and appropriate accessors and mutators.c. A toString method that overrides the toString method in the base class. The…arrow_forwardCreate an Investment class that contains fields to hold the initial value of an investment, the current value, the profit (calculated as the difference between current value and initial value), and the percent profit (the profit divided by the initial value). Include a constructor with two arguments: initial, and current values and then calculate profit, and percent profit, and a display function that displays all fields. Create a House class that includes fields for street address and square feet, a constructor that requires values for both fields, and a display function. Create a HouseThatIsAnInvestment class that inherits from Investment and House. It includes a constructor (in order to pass arguments to its parent constructors) and a display function that calls the display functions of the parents. Write a main() function that declares a HouseThatIsAnInvestment and displays its values.arrow_forwardIn Javascript, Pet Class: Design a class named Pet, which should have the following fields and methods: name: The name of a pet type: The type of animal the pet is ("Dog", "Cat", "Lizard", etc.) age: The age of the pet. setName: The setter for the name field. getName: The getter for the name field. setType: The setter for the type field. getType: The getter for the type field. setAge: The setter for the age field. getAge: The getter for the age field. Once you have designed the class, create an instance of the class and use the setter and getter methods to store data in the object and display the data.arrow_forward
- Practice with writing a program that contains three classes: Ship CruiseShip CargoShip Classes Design a Ship class with the following members: A field for the name of the ship (a string) A field for the year that the ship was built (a string) A constructor that accepts two arguments for the two fields, and appropriate accessors and mutators A toString method that returns a string with the ship’s name and the year it was built Design a CruiseShip class that extends the Ship class. The CruiseShip class should have the following members: A field for the maximum number of passengers (an int) A constructor that accepts three arguments for the three fields and appropriate accessors and mutators A toString method that overrides the toString method in the base class. The CruiseShip class’s toString method should return a string with only the ship’s name and the maximum number of passengers. Design a CargoShip class that extends the Ship class. The CargoShip class should have the…arrow_forwardWrite a class named Aircraft that has the following member variables: xear - An variable that holds the aircraft's model year. make - A string object that holds the make of the aircraft Qwuer: A string object that holds the type of owner of the aircraft. speed - An int that holds the aircraft's current speed. altitude, An int that holds the aircraft's current altitude. engine type- a String value to hold the type of the engine the aircraft has In addition, the class should have the following member functions. Constructor - The constructor should accept the aircraft's owner and make arguments and assign these values to the object's owner and make member variables. The constructor should initialize the speed variable to 0 and the altitude variable to 0. Accessors - Appropriate accessor functions should be created to allow values to be retrieved from an object's year, make, owner, altitude, and speed member variables. Mutator - Appropriate mutator function should be created to allow the…arrow_forwardWrite a class named Employee that has the following fields: name: The name field is a String object that holds the employee's name. idNumber: The idNumber is an integer variable that holds the employee's ID number. department: The department field is a String object that holds the name of the department where the employee works. position: The position field is a String object that holds the employee's job title. Write mutator methods that store values in these fields and accessor methods that return the values in these fields. Once you have written the class, write a separate program that creates three Employee objects to hold the following data. Name ID Number Azah Samsudin Mira Kamal Che Yah Sam Department Computer Science Biomedical Language Position Programmer Researcher Lecturer 11011 35125 80001 The program should store the data in the three objects and then display the data for each employee on the screen.arrow_forward
- 1. Create a class as described below: Class Name: Room Fields: standard room fee amenities total cost Constructors:A default constructor to initialize the fields. The standard room fee field should be set to $200 and the amenities field to zero. Another constructor with one argument. It should assign this value to the standard room fee and the amenities field to the default value of $75. Methods: getStandardFee() - This methods returns the standard room fee field value. getAmenities() - This method returns the amenities field value. getTotalCost() - This method returns the total cost field value. calcTotalCost() - This method calculated the total cost for an instance of the class setStandard Fee() - This method has one argument representing the standard room fee. setAmenities() - This method has one argument representing the amenities for the room.arrow_forwardDesign a class named PhoneCall with four fields: two strings that hold the 10-digit phone numbers that originated and received the call, and two numeric fields that hold the length of the call in minutes and the cost of the call. Include a constructor that sets the phone numbers to Xs and the numeric fields to 0. Include get and set methods for the phone number and call length fields, but do not include a set method for the cost field. When the call length is set, calculate the cost of the call at three cents per minute for the first 10 minutes, and two cents per subsequent minute. Create the class diagram and write the pseudocode that defines the class.arrow_forward2. Car Class Write a class named car that has the following fields: ▪ yearModel. The year Model field is an int that holds the car's year model. ▪ make. The make field is a String object that holds the make of the car, such as "Ford", "Chevrolet", "Honda", etc. ▪ speed. The speed field is an int that holds the car's current speed. In addition, the class should have the following methods. ■ Constructor. The constructor should accept the car's year model and make as arguments. These values should be assigned to the object's year Model and make fields. The constructor should also assign 0 to the speed field.arrow_forward
- Help me With this Java Taskarrow_forwardStatic & Not Final Field: Accessed by every object, Changing Non-Static & Final Field: Accessed by object itself, Non-Changing Static & Final: Accessed by every object, Non-Changing Non-Static & Not Final Field: Accessed by object itself, ChangingRead the following situation and decide how the variables should be defined. You have a class named HeartsPlayerA round of Hearts starts with every player having 13 cardsPlayers then choose 3 cards to “trade” with a player (1st you pass left, 2nd you pass right, 3rd you pass across, 4th you keep)Players then strategically play cards in order to have the lowest scoreAt the end of the round, points are cumulatively totaled for each player.If one player’s total is greater than 100, the game ends and the player with the lowest score wins. 1. How should the following data fields be defined (with respect to final and static)?(a) playerPosition (These have values of North, South, East, or West)(b) directionOfPassing(c) totalScore…arrow_forwardAssignment 10: Chapter 10 Complete Programming Challenge 10 at the end of chapter 10 10. Ship, CruiseShip, and CargoShip Classes Design a Ship class that the following members: A field for the name of the ship (a string) - A field for the year that the ship was built (a string). A constructor and appropriate accessors and mutators. A toString method that displays the ship's name and the year it was built. Design a CruiseShip class that extends the Ship class. The CruiseShip class should have the following members: A field for the maximum number of passengers (an int). A constructor and appropriate accessors and mutators. A toString method that overrides the toString method in the base class. The CruiseShip class's toString method should display only the ship's name and the maximum number of passengers. Design a CargoShip class that extends the Ship class. The CargoShip class should have the following members: A field for the cargo capacity in tonnage (an int). A constructor and…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
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