EBK JAVA PROGRAMMING
9th Edition
ISBN: 9781337671385
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
expand_more
expand_more
format_list_bulleted
Question
Chapter 14, Problem 6RQ
Program Plan Intro
Program Plan:
To find the correct answer from the given set of options.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
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( ).
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…
You are required to create above frame,
Create a class HelloFrame and extend it from JFrame
Inside HelloFrame declare
3 textfields for taking string input for name, email and number variables
1 textarea to write a message.
Create a button “Submit” which should submit the form.
Now create a public constructor for HelloFrame inside which
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.
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”.
Run the code and make sure the output should be as above frame.
Chapter 14 Solutions
EBK JAVA PROGRAMMING
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 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_forwardYou are required to create above frame, Create a class HelloFrame and extend it from JFrame Inside HelloFrame declare 3 textfields for taking string input for name, email and number variables 1 textarea to write a message. Create a button “Submit” which should submit the form. Now create a public constructor for HelloFrame inside which 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 method "Contact US Panel" similarly create labels for showing name, email, number. Add textfields and button to JFrame. Run the code and make sure the output should be as above frame.arrow_forwardCreate an application named TestClassifiedAd that instantiates and displays at least two ClassifiedAd objects. A ClassifiedAd has fields for a Category (For example, Used Cars and Help Wanted), a number of Words, and a price. Include properties that contain get and set accessors for the category and number of words, but only a get accessor for the price. The price is calculated at nine cents per word. Note: Your output should be formatted as: The classified ad with 100 words in category Used Cars costs $9.00 The classified ad with 60 words in category Help Wanted costs $5.40 In order to prepend the $ to currency values, the program will need to use the CultureInfo.GetCultureInfo method. In order to do this, include the statement using System.Globalization; at the top of your program and format the output statements as follows: WriteLine("This is an example: {0}", value.ToString("C", CultureInfo.GetCultureInfo("en-US"))); using static System.Console; using System.Globalization; public…arrow_forward
- FOR JAVA, PLEASE URGENT Part I Use Company class and create OptionDialog for 5 any methods about company. Part II Modify the methods to get input from user by dialog systems (InputDialog, OptionDialog etc.). You can add more if you don’t have proper methods to utilize dialogues. Part III Modify the exception handling codes to show the caught error by MessageDialog. Part IV Create an UI by JFrame in order to initialize the Company objects.arrow_forwardCreate an application named PhotoDemo that demonstrates the methods of three related classes for a company that develops photographs.Create a class named Photo that includes fields for width and height in centimeters and properties for each field. Include a protected price field, and set it to $3.99 for an 8-inch by 10-inch photo, $5.99 for a 10-inch by 12-inch photo, and $9.99 for any other size (because custom cutting is required). The price field requires a get accessor but no set accessor. Also include a ToString() method that returns a string constructed from the values of the fields. Derive two subclasses MattedPhoto and FramedPhoto. The MattedPhoto class includes a string field to hold a color, and the FramedPhoto class includes two string fields that hold the frame’s material (such as silver) and style (such as modern). The price for a MattedPhotoincreases by $10 over its base cost, and the price for a FramedPhoto increases by $25 over its base cost. Each subclass should…arrow_forwardi need help for this code to create it in seperate files within the same file for each class. basically multiple files with the classes organized on visual studios. also could you include a flowchart for this code #include <iostream>#include <string> // Base class: Citizenclass Citizen {protected: std::string name; public: Citizen(const std::string & _name) : name(_name) {} virtual ~Citizen() {} virtual void payTaxes() const = 0; virtual void speak() const = 0;}; // Derived class: Wolfclass Wolf {public: void howl() const { std::cout << "The wolf howls." << std::endl; } void growl() const { std::cout << "The wolf growls." << std::endl; }}; // Derived class: Humanclass Human : public Citizen {public: Human(const std::string & _name) : Citizen(_name) {} void payTaxes() const override { std::cout << name << " pays taxes in dollars." << std::endl; } void speak()…arrow_forward
- 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 : Javaarrow_forwardJava question please Create a class called Account that has the following attributes: Account Client - AccountHolder Double - Balance Date - DateCreated Account() Account(Client AccountHolder, Double Balance) getAccountHolder() - Client setAccountHolder(Client) - void getBalance() - Double deposit(Double) - Double withdrawal(Double) - Double getDateCreated() - Date toString() - String compareTo(Account) - Integer equals(Account) - Double Notes: The account holder attribute will link to the Account class that you created in problem 6. Your constructor and overloaded constructor should set the date created to the current date. Your deposit method should add to the balance Your withdrawal method should remove from the balance, as long as there is enough money to withdrawalarrow_forwardHelp writing the SuccessInLife Class In Java, I will figure out driver class laterClass Fields/Variables: your class should have the following fields: A static class variable/field that keeps track of how many event objects have beencreated (0 by default). The following instance variables/fields: A 7 digit alpha numeric unique bar code for each event The location of the event, which starts with the name of the building followedby the room number Event name Event type, which can be one of the following Quantity, which represents how many seats are requested The event capacity (max number of spots allowed for this event)The number of seats already takenYou should select the appropriate data type for each variable above. Make all instancevariables private and make the static class variable public. Constructors: in addition to the default constructor, the class should have the followingoverloaded constructors: a constructor that receives the event name and event type as parameters, and…arrow_forward
- You are designing an application to rate your professors.a. Professors have the following properties: first name, last name, universityname, subject, and ratings for overall quality (1.0-5.0) and level of difficulty(1.0-5.0). Your class should have instance variables of the appropriatetype for each property.b. Your class should have two constructors: one that takes all properties, andone that takes only first name, last name, university name, and subjectand sets both of the ratings to an appropriate default value.c. You should provide accessors (getters) and mutators (setters) for firstname, last name, university name, and subject.d. Your class should provide a method to add a new rating for the professor.It should take two arguments: one for overall rating and one for level ofdifficulty, with values from 1 (awful) to 5 (awesome). Each time a newrating is provided, your class should calculate the average rating for theprofessor and update the appropriate variable for each.e. Your class…arrow_forwardIn Java Given the following CircleDriver.java file. Provide an accompanying Circle.javafile. Specifically, your Circle class should contain:• One instance variable – radius• A method named setRadius that assigns the passed-in radius value to the radiusinstance variable.• A method named initialize that prompts the user for a radius value and thenassigns the entered value to the radius instance variable.• A method named printCircleData that uses the circle’s radius to calculate thecircle’s diameter, circumference, and area. Use the Java API constant Math.PIfor the value of π. Print the circle’s radius, diameter, circumference, and area. Thereare many ways to implement printCircleData. In the interest of gainingexperience with local variables, declare and use local variables for storing thecircle’s diameter, circumference, and area. The Driver:/***************************************************** CircleDriver.java** This is the driver for the Circle…arrow_forwardCreate a class called FinalGrade that is used to represent the points obtained in the letter grade of CSC 110 by different students. The FinalGrade class should include three pieces of information as instance variables—studentName (type String), studentID (type String), and pointsObtained (type int). Your class should have a constructor that initializes the three instance variables. Provide a set and a get method for each and every instance variable. In addition, provide a method named computeLetterGrade that returns the letter grade obtained by the student taking the pointsObtained as an argument. For the grading policy refer to CSC 110 grading scheme specified in syllabus. Write a test application named FinalGradeDriver that creates at least 3 different objects of class FinalGrade and test all the methods of class FinalGrade. Sample Output Student Name : Homer SimpsonStudent ID : S123456Points Obtained : 99Letter Grade : A Student Name : Marge SimpsonStudent ID : S234567Points…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author: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
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
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