EBK JAVA PROGRAMMING
9th Edition
ISBN: 9781337671385
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Chapter 3, Problem 14RQ
Program Description Answer
A class client is a
Hence, the correct option is “a”.
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
Create a class HelloFrame and extend it from JFrame
o Inside HelloFrame declare
o 3 textfields for taking string input for name, email and number variables
o 1 textarea to write a message.
o Create a button “Submit” which should submit the form.
• Now create a public constructor for HelloFrame inside which
o You should call
super("Hello Java"); //used to set title of the frame
setSize(700, 400); //set length and width of the frame
create a label which should display the "Contact US Panel"
similarly create labels for showing name, email, number.
Add textfields and button to JFrame.
3. Bind and Action Listener with the button which reads the data and from the text fields and save it to File name ‘data.txt’ also show a dialog box showing “Submit button clicked, Data saved successfully”.
Programming language : Java
Create an application via NetBeans with named Pizza that storesinformation about a single pizza. It should contain the following:• Private instance variables to store the size of the pizza (eithersmall, medium, or large), the number of cheese toppings, the number ofbeef toppings, and the number of chicken toppings.• Constructor(s) that set all of the instance variables.• Public methods to get and set the instance variables.• A public method named calcCost( ) that returns a double that is thecost of the pizza.Pizza cost is determined by:
Small: OR10 + OR 2 per topping
Medium: OR 12 + OR 2 per topping
Large: OR 14 + OR 2 per topping• A public method named getDescription( ) that returns a Stringcontaining the pizza size, quantity of each topping, and the pizzacost as calculated by calcCost( ).
Write a java programme
create a text based user interface class called WorkOutUI
Create tow fields that will be accessible through the whole class
A static constant field called ABBA to store the string "Agnetha#Benny#Bjorn#annafrid".
A static field called an integer called totalPoints.
Code a method Called processWorkOuts.The method must accept the name of the member of Abba whose text file must be processed.This method must be called from the main method.
In the processWorkOuts Method:
Display the name of the Abba Group whose file is being processed.
add ".txt" to the file name sent as a parameter.
instantiate a WorkOut object called workOut Using the constructor:+constructor(p:real, n:interger) ,send 0 for an initial points value and 0 as the initial numWorkOuts value.
Open the text file and loop through the file extracting the start ,end,description and level fields from the file.Display an error message if the file cannot open. a) Instantiate a workout object using the…
Chapter 3 Solutions
EBK JAVA PROGRAMMING
Ch. 3 - Prob. 1RQCh. 3 - Prob. 2RQCh. 3 - Prob. 3RQCh. 3 - Prob. 4RQCh. 3 - Prob. 5RQCh. 3 - Prob. 6RQCh. 3 - Prob. 7RQCh. 3 - Prob. 8RQCh. 3 - Prob. 9RQCh. 3 - Prob. 10RQ
Ch. 3 - Prob. 11RQCh. 3 - Prob. 12RQCh. 3 - Prob. 13RQCh. 3 - Prob. 14RQCh. 3 - Prob. 15RQCh. 3 - Prob. 16RQCh. 3 - Prob. 17RQCh. 3 - Prob. 18RQCh. 3 - Prob. 19RQCh. 3 - Prob. 20RQCh. 3 - Prob. 1PECh. 3 - Prob. 2PECh. 3 - Prob. 3PECh. 3 - Prob. 4PECh. 3 - Prob. 5PECh. 3 - Prob. 6PECh. 3 - Prob. 7PECh. 3 - Prob. 8PECh. 3 - Prob. 9PECh. 3 - Prob. 10PECh. 3 - Prob. 11PECh. 3 - Prob. 12PECh. 3 - Prob. 13PECh. 3 - Prob. 1GZCh. 3 - Prob. 2GZCh. 3 - Prob. 1CP
Knowledge Booster
Similar questions
- Create an application class named LetterDemo that instantiates objects of two classes named Letter and CertifiedLetter and that demonstrates all their methods. The classes are used by a company to keep track of letters they mail to clients. The Letter class includes auto-implemented properties for the name of the recipient and the date mailed. Also, include a ToString() method that overrides the Object classs ToString() method and returns a string that contains the name of the class (using CetType and the Letters data field values. Create a child class named CertifiedLetter that includes an auto-implemented property that holds a tracking number for the letter.arrow_forwardCreate an application named TurningDemo that creates instances of four classes: Page, Corner, Pancake, and Leaf. Create an interface named ITurnable that contains a single method named Turn The classes named Page, Corner, Pancake, and Leaf implement ITurnable. Create each classs Turn() method to display an appropriate message. For example, the pages Turn() method might display You turn a page in a book.arrow_forwardCreate an application named RecoveringDemo that declares objects of three types: Patient, Upholsterer, and FootballPlayer. Create an interface named IRecoverable that contains a single method named Recover(). Create the classes named Patient, Upholsterer, and FootballPlayer so that each implements IRecoverable. Create each class’s Recover() method to display an appropriate message. For example, the Patient’s Recover() method might display “I am getting better. C# Programmingarrow_forward
- For given java program below: Create a class called TestUserprofile with main method where a user wants to create a new profile. The user will enter their name and choose their favourite Genre from a displayed list of the possible Genres. The user will then see a message that their userProfile was created. public class UserProfile { private String userID;//the userID private String genre;// the user's preferred genre of movie private String[] genres = {"Comedy", "Drama", "Action", "Mystery"};//available genres of movies /** * A constructor that takes in the userID and the favourite genre * @param givenID the ID to assign to this user * @param givenGenre the users favourite genre */ public UserProfile(String givenID, String givenGenre) { userID = givenID; genre= givenGenre; } /** * A getter for the userID * @return the userID */ public String getUserID() { return userID; } /** * @param userID the userID to set…arrow_forward3.a. Create an interface named Turner, with a single method named turn(). Create a class named Leaf that implements turn() to display Changing colors. Create a class named Page that implements turn() to display Going to the next page. Create a class named Pancake that implements turn() to display Flipping. Write an application named DemoTurners that creates one object of each of these class types and demonstrates the turn() method for each class. Save the files as Turner.java, Leaf.java, Page.java, Pancake.java, and DemoTurners.java. 3.b. Think of two more objects that use turn(), create classes for them, and then add objects to the DemoTurners application, renaming it DemoTurners2. java. Save the files, using the names of new objects that use turn(). 3.c. Apply Dynamic method dispatch to show the power of it and name the class as DemoTurners3.arrow_forwardJavaProgramming 3.a. Create a class named Circle with fields named radius, area and diameter. Include methods names setRadius(), getRadius(), computeDiameter() which computes a circles’s diameter and computeArea which computes a circle’s area. The diameter of a circle is twice its radius and the area is 3.14 multiplied by the square of the radius. b. Create a class named TestCircle whose main() declares three Circle objects. Using the setRadius() method, assign one circle a small radius value. Assign another circle a larger radius value and assign the third circle a radius of 1. Call computeDiameter() and computeArea() for each circle and display the results.arrow_forward
- Create a method named getCircleDiameter that takes a radius of double type as the parameter. The method should return the diameter of a circle. To compute the diameter of a circle, multiply the radius by 2.Create a struct named Product where its fields are code, description, and price. Create a class named Person with an instance variable named full_name. Declare one (1) constructor without a parameter and initialize the variable with a default value.Create a class named Account with an instance variable named account_number. Make this class a member of the Accounts namespace.arrow_forwardCreate an application named RecoveringDemo that declares objects of three types: Patient, Upholsterer, and FootballPlayer. Create an interface named IRecoverable that contains a single method named Recover(). Create the classes named Patient, Upholsterer, and FootballPlayer so that each implements IRecoverable. Create each class’s Recover() method to display an appropriate message. For example: The Patient’s Recover() method should display I am getting better. The Upholsterer's Recover() method should display I have new material for the couch. The FootballPlayer's Recover() method should display I picked up the ball after a fumble.arrow_forwardPlease Use Netbeans Create four pages:Three Classes: Employee, Department, and CompanyA program MyCompany which supplies employee name and salary information and prints out the totalsalary of all the employees.Pass in all four .java files.1) Create a class called "Employee" with the following properties:name (String)age (int)salary (double)In the Employee class, create a constructor that accepts and sets an employee’s name, age, and salary.Create getters for name, age, and salary.2) Create a class called "Department" with the following properties:i (int)name (String)Employee[] employees=new Employee[10];In the Department class, create a constructor that accepts and sets the department name. Also set i=0(to initialize the value).In the Department class create a method called "addEmployee" that accepts an Employee object andadds it to the array of employees. (Hint, include i++ to increment the value of i.)In the Department class, create a method called "getTotalSalary" as follows:public…arrow_forward
- The project downloaded contains a package (folder) named Q3 within the src folder. The purpose of Question 3 is to examine your understanding of classes and inheritance. Inside Q3 is a completed Java class named Location. Location contains three fields: • locationName: name of location (String) • latitude: latitude of location (Double)• longitude: longitude of location (Double) Conceptually, the Location class represents a geographic location (e.g. a city). You do not need to modify the Location class. In this question you will complete an additional class named EuclideanRoute. The fields of the EuclideanRoute class consist of two Location objects named origin and destination. Therefore, a EuclideanRoute object represents the start/end points of a route a vehicle takes. The EuclideanRoute class is derived from the RouteInformation class and the routeDestination method calculates the distance from the origin to the destination using the formula for Euclidean distance. Finally, in the…arrow_forwardWrite a class called Fraction; this class will be designed to handle fractions. The Fraction class has only two instance variables: An integer numerator An integer denominator The two instance variables can be publicly accessible (at this stage). The Fraction class should never store a value of 0 for the denominator. Supply an output method for the Fraction class; this method will be used by the client to print out a fraction (as two separate integers) to the screen. An output fraction would be in the form: numerator / denominator An example: the fraction for a half would be input as 1 for the numerator and 2 for the denominator. The output should be printed out as 1 / 2. Once this is done, write a client class program called TestFraction; this class is to be used to test your Fraction class. Note that the client program should use the Fraction class methods or instance variables (via the dot notation) to get the inputs and display the fractions. The client class should use a loop for…arrow_forwardI. Create a class named Rectangle. 1. There are two int instance variables: width and length. 2. Create three constructors. a. Take two arguments from a client to the instance variables. b. Take one argument from a client to the instance variables; set it as a square instead of rectangle. c. No-argument constructor. Set up the way to take user information from keyboard. 3. Create 7 methods. a. getWidth(): return width to caller. b. getLength(): return length to caller. c. setWidth(): take one argument to reset width. d. setLength(): take one argument to reset length. e. getArea(): calculate area of rectangle and return area to caller. f. getPerimeter(): calculate perimeter of rectangle and return perimeter to caller. g. toString(): return a String with the information about width, length, area, and perimter of the object to caller. II Create a class named Yard which inherits Rectangle. 1. There is one more double instance variable: unitPrice. 2.…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher: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:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT