EBK JAVA PROGRAMMING
8th Edition
ISBN: 9781305480537
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
expand_more
expand_more
format_list_bulleted
Question
Chapter 4, Problem 11PE
a.
Program Plan Intro
CertOfDeposit
Program Plan:
CertOfDeposit.java:
- Define the class “CertOfDeposit”.
- Declare and initialize the required variable.
- Definition of constructor.
- Assign the variables.
- Define the mutator method for certificate number.
- Assign “n” to “certNum”.
- Define the mutator method for owner name.
- Set the name.
- Define the mutator method for balance.
- Set the balance.
- Define the mutator method for issue date..
- Set the balance.
- Define the accessor method for certificate number.
- Return the certificate number.
- Define the accessor method for name.
- Return the name
- Define the accessor method for balance.
- Return the balance.
- Define the accessor method for issue date.
- Return the issue date.
- Define the accessor method for maturity date.
- Return the maturity date.
b.
Program Plan Intro
TestCertOfDeposit.java
Program Plan:
TestCertOfDeposit.java:
- Define the class “TestCertOfDeposit”.
- Definition of method main.
- Declare the required variable.
- Get the certificate name from the user.
- Get the owner name from the user.
- Get the balance from the user.
- Get the issue date from the user.
- Call the method “display()”.
- Definition of method “display()”.
- Print the details of the certificate.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Create a class Course to describe a course according to the following requirements: A course has three attributes: courseName, courseCode, fees.
Create a constructor without parameters to initialize all the instance variables to default values (0 for numbers and "" for a string).
Create a constructor to initialize all the attributes to specific values.
Add all setter and getter methods
Create a tester class with the main method. The tester class must be named using your first and last In this class performs the following:
Create a course object c1 using the default constructor.
Create a course object c2 with the following information: courseName =” object oriented programing”, courseCode = “CS230” , fees = a value from your choice.
Change the course fees of c2 to your age.
Print the course information of c2 using getter methods
I attached Typical run of the program
Create a class named Person that holds the following fields: two String objects for the person’s first and last name and a LocalDate object for the person’s birthdate. Create a class named Couple that contains two Person objects. Create a class named Wedding for a wedding planner that includes the date of the wedding, the Couple being married, and a String for the location.
Provide constructors for each class that accept parameters for each field, and provide get methods for each field.
Create a class named BloodData that includes fields that hold a blood type (the four blood types are O, A, B, and AB) and a Rh factor (the factors are + and –). Create a default constructor that sets the fields to O and +, and an overloaded constructor that requires values for both fields. Include get and set methods for each field.
Create a class named Patient that includes id, age, and bloodData fields. Provide a default constructor that sets the ID number to 0, the age to 0, and the BloodData values to O and +. Create an overloaded constructor that provides values for each field. Also provide get methods for each field.
The TestBloodData.java and TestPatient.java files have been provided to test your implementation of each class.
Code is in java.
Chapter 4 Solutions
EBK JAVA PROGRAMMING
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. 12PECh. 4 - Prob. 1GZCh. 4 - Prob. 2GZ
Knowledge Booster
Similar questions
- Create a class named FootballTeam. Include two fields that hold data about theteams participating in the game. Also include a field for game time (for example, 5PM). Include a constructor that takes parameters for two FootballTeam objects anda time. From the main method, instantiate a FootballTeam object, then pass theGame to a method that displays the details about the FootballTeam.arrow_forward1. Create a class named Book and declare the fields author, title and pages with suitable field types. 2. Declare the constructor and initialize the fields author and title with the assigned constructor parameter. 3. Name the constructor parameter as your own. 4. Add two accessor methods to the class getAuthor, getTitle and getPagesthat return the author and title fields as their respective results. Add mutator method to change the pages of the Book class. 5. Add two methods, printAuthor and printTitle, to this Book class project. These should print the author and title fields, respectively, to the terminal window.arrow_forwardGiven main(), complete the FoodItem class (in file FoodItem.java) with constructors to initialize each food item. The default constructor should initialize the name to "Water" and all other fields to 0.0. The second constructor should have four parameters (food name, grams of fat, grams of carbohydrates, and grams of protein) and should assign each private field with the appropriate parameter value. Ex: If the input is: Water the output is: Nutritional information per serving of Water: Fat: 0.00 g Carbohydrates: 0.00 g Protein: 0.00 g Number of calories for 1.00 serving(s): 0.00 Ex: If the input is: M&M's 10.0 34.0 2.0 3.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 3.0 is the number of servings, the output is: Nutritional information per serving of M&M's: Fat: 10.00 g Carbohydrates: 34.00 g Protein: 2.00 g Number of calories for 1.00 serving(s): 234.00 Number of calories for 3.00 serving(s):…arrow_forward
- Create a class of Dog, some of the differences you might have listed out maybe breed, age, size, color, etc. Then create characteristics (breed, age, size, color) can form a data member for your object. Then list out the common behaviors of these dogs like sleep, sit, eat, etc. Design the class dogs with objects and methods.arrow_forwardCreate a class named State that holds the following fields: a String for the name of the state, an integer forthe population, and two City objects that hold data about the capital city and the most populous city. TheState constructor requires six parameters that represent the names and populations of the state, its capital,and its most populous city. Provide get methods for each field. Create the City class to be a nonstatic, privateinner class within the State class; the City class contains a city’s name and population. Create a class to assign values to and display values from two State objects. Save the files as State.java and TestState.java.arrow_forwardCreate a class that contains an address book entry and name it AddressBook. a.The table below describes the information that an address book entry has. Attributes/Field Description Name Name of the person in the address book Address Address of the person Mobile Number Mobile number of the person Email Address Email address of the person b.The class definition should contain the following: Attributes Constructor Accessors and mutators Test Stem / Question Choices 1: How many attributes should be defined in AddressBook class? A: 1 B: 2 C: 3 D: 4 E: None of the above 2: How many accessors should be defined in AddressBook class? A: 1 B: 2 C: 3 D: 4 E: None of the above 3: How many mutators should be defined in AddressBook class? A: 1 B: 2 C: 3 D: 4 E: None of the above 4: What is the name of the Constructor? A: AddressBook B: AddressBook() C: public AddressBook…arrow_forward
- Java - Constructors Create a class named Book that has the following attributes: Publisher - String Year Published - Integer Price - Double Title - String Create a constructor for the class Book that has the parameters from the attributes of the class. After, create a method for the class that displays all attributes. Ask the user for inputs for the attributes and use the constructor to create the object. Lastly, print the values of the attributes. Inputs 1. Publisher 2. Year Published 3. Price 4. Book Title XYZ Publishing 2020 1000.00 How to Win? Sample Output Published: ABC Publishing Year Published: 2022 Price: 150.00 Book Title: Stooping too low Stooping too low is published by ABC Publishing on 2022. It sells at the price of Php150.00.arrow_forwardYou are required to create a program that simulates an ATM with below requirements:Create a class called Account that contains:• An int data field named id that stores the accounts unique identification number.• A double data field named balance that stores the current balance of the account.• A Date data field named dateCreated that stores the date on which the account was created.• A constructor that creates an account with the specified id and initial balance.• Methods that return the values of all data fields.• Methods that set the values of the id and balance data fields.• A method named withdraw that withdraws a specified amount from the Account.• A method named deposit that deposits a specified amount into the account.• A method named printStatement that print the user statement. Option 1:Check Balance: This will allow the user to view the current balance. Use JOptionPane to display the balance from the data base. Option 2:Withdraw: This will provide another window (Do not use…arrow_forwardYou are required to create a program that simulates an ATM with below requirements:Create a class called Account that contains:• An int data field named id that stores the accounts unique identification number.• A double data field named balance that stores the current balance of the account.• A Date data field named dateCreated that stores the date on which the account was created.• A constructor that creates an account with the specified id and initial balance.• Methods that return the values of all data fields.• Methods that set the values of the id and balance data fields.• A method named withdraw that withdraws a specified amount from the Account.• A method named deposit that deposits a specified amount into the account.• A method named printStatement that print the user statement. Option 1:Check Balance: This will allow the user to view the current balance. Use JOptionPane to display the balance from the data base. Option 2:Withdraw: This will provide another window (Do not use…arrow_forward
- Design a class named Triangle that extends the GeometricObject class. The Triangle class contains:■ Three float data fields named side1, side2, and side3 to denote the threesides of the triangle.■ A constructor that creates a triangle with the specified side1, side2, andside3 with default values 1.0.■ The accessor methods for all three data fields.■ A method named getArea() that returns the area of this triangle.■ A method named getPerimeter() that returns the perimeter of this triangle.■ A method named _ _str_ _() that returns a string description for the triangle. For the formula to compute the area of a triangle, see Exercise 2.14. The_ _str_ _() method is implemented as follows:return "Triangle: side1 = " + str(side1) + " side2 = " +str(side2) + " side3 = " + str(side3)Draw the UML diagrams for the classes Triangle and GeometricObject.Implement the Triangle class. Write a test program that prompts the user to enter the three sides of the triangle, a color, and 1 or 0 to indicate…arrow_forwardCreate a class for Subject containing the Name of the subject and score of the subject. There should be following methods: set: it will take two arguments name and score, and set the values of the attributes. If score is less than 0 or greater than 100.0 then a message should be displayed “Incorrect score” and score should be set to Zero. set: it will take one double value as argument and set the value of score only. If score is less than 0 or greater than 100.0 then a message should be displayed “Incorrect score” and score should be set to Zero. display: it will display the name and score of the subject. Like “Name : Math, Score: 99.9” getScore: it will return the value of score. greaterThan: it will take subject’s object as argument, compare the calling object’s score with argument object’s score and return true if the calling object has greater score. Create a class “Main” having main method to perform following tasks. Create two objects of Subject class having value “Math, 99.9”…arrow_forwardCreate a class for Subject containing the Name of the subject and score of the subject. There should be following methods: set: it will take two arguments name and score, and set the values of the attributes. If score is less than 0 or greater than 100.0 then a message should be displayed “Incorrect score” and score should be set to Zero. set: it will take one double value as argument and set the value of score only. If score is less than 0 or greater than 100.0 then a message should be displayed “Incorrect score” and score should be set to Zero. display: it will display the name and score of the subject. Like “Name : Math, Score: 99.9” getScore: it will return the value of score. greaterThan: it will take subject’s object as argument, compare the calling object’s score with argument object’s score and return true if the calling object has greater score. Create a class “Main” having main method to perform following tasks. Create two objects of Subject class having value “Math, 99.9”…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,
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,