An online retailer sells six products whose prices are as follows: key description price 1 Hat 9.99 2 Coat 69.99 3 Jacket 49.99 4 Ball 2.92 5 Club 21.97 6 Marker .99 Your task will be to generate a sales receipt for the item sold which will include the item key, item description, item price, quantity ordered and the item extended price. Part One: Write well-formed SalesItem class. Instance variables Key: String Description: String Price: double Quantity: integer Constructors Default data will be all zeros except product which will be null Full arguments Get and Set methods ToString The SalesItem class must be defined in its own file.
Q: In this question, we will bake a class. Create a class Cake, with the following instance attributes:…
A: Answer:
Q: . A Date class that includes three instance variables, a month, a day, and an year. Provide a…
A: As per the given description, we implemented the Data class and DataTest to test the Data class
Q: 1. Write a class "Ball" which extends the class disk. It has deltax and deltay attributes. 2. Write…
A: Code in Java Language : - class disk { } class Ball extends disk { private int deltaX, deltaY;…
Q: An Electronics Shop wants to keep track of its inventory. It needs to save information about each…
A:
Q: Write a new class called DistanceFitnessTracker that extends FitnessTracker. DistanceFitnessTracker…
A: Distance.javaDistanceFitnessTracker.javaFitnessExperiment.javaFitnessTracker.javaHeartRate.javaHeart…
Q: 3. Next to these lines, add the following code. class Apple int x - 5; Apple() {…
A: Super Keyword in Java: The super keyword in Java is a reference variable that is used to refer to…
Q: A class called Author is designed to model a book's author. It contains: • Three private instance…
A: class Author { private String name; private String email; private boolean gender; //male=false;…
Q: Write some Java code involving if, else if, and else statements that are equivalent to the following…
A: As per guidelines we are supposed to answer only one question. Kindly repost other questions as a…
Q: Implement a class called Account which defines a modified banking account that can be created with a…
A: public class Account { //declare instance variables private String accountName; private double…
Q: The following is a class definition for a simple Ebook. Two instance variables and one parameterless…
A: Program Approach: Create constructor which takes array of type string as parameter and a string…
Q: D Create a class Sum with the following fields, constructors and methods: Fields: create two…
A: As per the requirement program is developed. Note: In the question programming language is not…
Q: Consider the following code snippet. public interface Measurable { double getMeasure): } public…
A: For the given interface concept program the correct statement is ?
Q: (Java) Create an HourlyEmployee class that inherits from Employee and has two new instance…
A: Given data, Create an HourlyEmployee class that inherits from Employee and has two new instance…
Q: Consider the following code snippet. public interface Measurable { double getMeasure); } public…
A: Java provides upcasting implicitly and downcasting explicitly. If you try to do downcasting…
Q: Java program In yourLastNameArena.java: 1. define: 1 static variable: yourLastNameSlogan(string)…
A: The ask is to do the following for yourLastNameArena.java: - define: 1 static variable:…
Q: For this Programming Employee class should have instance variables to store the employee ID as an…
A: Step 1 : Create Empolyee class and two variable instance of id int and String dept Step 2 : create…
Q: / Is my code correct? //please make it more efficient as you can. Thank you //please correct it if…
A: Solution: error free and successfully executed program is following - Programming language -…
Q: reate a class called Date212 to represent a date. It will store the year, month and day as integers…
A: Given Create a class called Date212 to represent a date. It will store the year, month and day…
Q: in java A class Book is designed to model a book written by one author. It contains: Four private…
A: //Driver code import java.util.*; public class Main { public static void main(String[] args) {…
Q: write a class called OneItemBag ( OneItemBag.java ). This class represents a bag that can hold any…
A: According to the question, we have to write code for a class called OneItemBag ( OneItemBag.java ).…
Q: consider the following code snippet: class A{ public: A0{ class B: private A{ B); }; main0{ B *b =…
A: Definition: Constructor: It is an object oriented programming language that is based on the…
Q: res plays the three variables' values in sentences. tor method with three parameters for the three…
A: I give the code along with output and code screenshot
Q: This program extends the earlier "Online shopping cart" program. (Consider first saving your earlier…
A: the answer is given below:-
Q: Assume we have a class called Animals and within this class we have a method called toString(), and…
A:
Q: N JAVA Write a class Store which includes the attributes: store name, city. Write another class…
A: Step 1 The code is given in the below step by step
Q: uppose you have opened an account with an initial amount of $50 and you have to add some more amount…
A: class AddAmount{ private int amount = 50; public AddAmount() //Default Constructor {…
Q: Create a class called Pyramid. A Pyramid is described by three pieces of private information as…
A: Here I have first of all created the class Pyramid with the data members as defined in the question.…
Q: Complete the FoodItem class by adding a constructor to initialize a food item. The constructor…
A: main.cpp #include "FoodItem.h"#include <stdio.h>#include <iostream> using namespace std;…
Q: From 1925 through 1963, Burma Shave advertising signs appeared next to highways all across the…
A: Burma Shave billboards appeared beside highways across the United States from 1925 to 1963. Four or…
Q: For the Faculty class, create the following: A private int instance variable m salary. A constructor…
A: A class is a group of objects which have common properties. A constructor is a method that is used…
Q: 1. Create a class called Student, with the following attributes/variables: a. studentName (String)…
A: Answer: Our instruction is answer the first three part from the first part and . I have done code in…
Q: Using OOP in java Create a class called Employee that includes three pieces of information as…
A: Algorithm: Create a category known as worker that has 3 items of knowledge as instance variables* -…
Q: Define a new “User” class that contains a username (string), a password (string) and user id number…
A: The objects of a class can be passed as arguments to member functions as well as nonmember functions…
Q: In many card games, cards are either face up or face down. Add a new instance variable named faceup…
A: Programming is a way to instruct the computer devices to operate. Every computer needs a set of…
Q: n many card games, cards are either face up or face down. Add a new instance variable named faceup…
A: According to the information given:- We have playing cards in that they are either face up or face…
Q: A. Create a BankAccount class. We want to be able to create a new bank account, make deposits and…
A: For creating the Bank account project we need two classes inorder to represent the Bank account…
Q: A class called Book is designed to model a book written by one author. It contains: • Four private…
A: In Python, constructors enable assigning the initial values to attributes of an instance of a class.…
Q: Stage 3: In the third file Mailbox.java, create a class named Mailbox that models a mailbox that…
A: import java.util.ArrayList; class Message//class of name Message{String sender;//varible declare as…
Q: Imagine a tollbooth at a bridge. Cars passing by the booth are expected to pay a 50 cent toll.…
A: Code: #include <iostream>using namespace std; class tollbooth { private: int…
Q: Create a class Rectangle with parameters length, breadth, and color. Use appropriate data types and…
A: Using C++ Language here
Q: Your task is to implement the following DigitalWallet class. The description of the class is as…
A: In this question we have to write a JAVA program, Where DigitalWallet class has to be executed with…
Q: Many city ordinances have a requirement that buildings be surrounded by a certain amount of empty…
A: Given: Information regarding buildings in a city is provided and a class Building is created along…
Q: In this question, we will bake a class. Create a class Cake , with the following instance…
A: import random class Cake: name = "" ingreds = [] price = 0 #Constructor def…
Q: You are required to build a class to represent the a cup of coffee. Call your class CoffeeCup. A…
A: Algorithm: Start Create a class CoffeeCup with type,temp,volume and sugar as its attributes…
Q: Write the ComplexNumber class so that the following code generates the output below. |class…
A: We need to write ComplexNumber class for the given scenario in Python.
Q: in java you are required to build a mini PetCare application for the pet owners to keep track of…
A: public class Tester{ public static void main(String[] args) { //declaring main method Pet p…
Q: Create a class called Triangle that has two private instance variables: base and height (double).…
A: The variables declared here are private. Private variables can only be accessed by the class in…
Q: * This class describes a tweet. A tweet has a message in it, a unique ID, * a count of the number of…
A: EXPLANATION: - The Tweet class comprises instance variables of the following instance variables: -…
An online retailer sells six products whose prices are as follows:
key |
description |
price |
1 |
Hat |
9.99 |
2 |
Coat |
69.99 |
3 |
Jacket |
49.99 |
4 |
Ball |
2.92 |
5 |
Club |
21.97 |
6 |
Marker |
.99 |
Your task will be to generate a sales receipt for the item sold which will include the item key, item description, item price, quantity ordered and the item extended price.
Part One: Write well-formed SalesItem class.
- Instance variables
- Key: String
- Description: String
- Price: double
- Quantity: integer
- Constructors
- Default data will be all zeros except product which will be null
- Full arguments
- Get and Set methods
- ToString
- The SalesItem class must be defined in its own file.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
- 1. Create a class called Student, with the following attributes/variables:a. studentName (String)b. studentNumber (int)sc. regYear(long)d. faculty(String)e. department(String)2. Add the following methods in Student:a. accessors and mutators for all variablesb. toString methodi. Formulate your toString so that it only shows studentName,studentNumber and faculty3. Create a class called MyFriends, with the following attributes variables:a. studentArray(Student[])4. Add the following methods in MyFriends:a. fillArrayi. Using scanner ask how many students does the user want to inputii. Capture user input for all of his friends(Of course we are assuming all your friends would be similarUWC students, go ask around and meet new friends, alsopreferably not in the same Computer Science department … ifpossible … only if possible)b. maini. Call the fillArray methodii. Count how many Computer Science studentsiii. If half or more students are Computer Science students, thendisplay “You … need more…Create 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…a. Write a FractionDemo program that instantiates several Fraction objects and demonstrates that their methods work correctly. Create a Fraction class with fields that hold a whole number, a numerator, and a denominator. In addition: Create properties for each field. The set access or for the denominator should not allow a 0 value; the value defaults to 1. Add three constructors. One takes three parameters for a whole number, numerator, and denominator. Another accepts two parameters for the numerator and denominator; when this constructor is used, the whole number value is 0. The last constructor is parameterless; it sets the whole number and numerator to 0 and the denominator to 1. (After construction, Fractions do not have to be reduced to proper form. For example, even though 3/9 could be reduced to 1/3, your constructors do not have to perform this task.) Add a Reduce() method that reduces a Fraction if it is in improper form. For example, 2/4 should be reduced to 1/2. Add an operator+() method that adds two Fractions. To add two fractions, first eliminate any whole number part of the value. For example, 2 1/4 becomes 9/4 and 1 3/5 becomes 8/5. Find a common denominator and convert the fractions to it. For example, when adding 9/4 and 8/5, you can convert them to 45/20 and 32/20. Then you can add the numerators, giving 77/20. Finally, call the Reduce() method to reduce the result, restoring any whole number value so the fractional part of the number is less than 1. For example, 77/20 becomes 3 17/20. Include a function that returns a string that contains a Fraction in the usual display format—the whole number, a space, the numerator, a slash (D, and a denominator. When the whole number is 0, just the Fraction part of the value should be displayed (for example, 1/2 instead of 0 1/2). If the numerator is 0, just the whole number should be displayed (for example, 2 instead of 2 0/3). b. Add an operator*() method to the Fraction class created in Exercise 11a so that it correctly multiplies two Fractions. The result should be in proper, reduced format. Demonstrate that the method works correctly in a program named FractionDemo2. c. Write a program named FractionDem03 that includes an array of four Fractions. Prompt the user for values for each. Display every possible combination of addition results and every possible combination of multiplication results for each Fraction pair (that is, each type will have 16 results).
- Assume the bank allows customers to open SavingAccount for which there are certain policies that shall be enforced when the account holder withdraw some amount. Here is the basic version of SavingAccount class. public class SavingAccount extends Account { private double minimumBalance = 10000; public SavingAccount(String title, double balance,boolean filer) { super(title, balance, filer); } @Override public void withdraw(double amount) { //... } } You are supposed to provide new definition of withdraw method that shall work as per following policies: The withdraw method shall proceed with transaction only if the remaining balance (after the transaction) do not goes below minimumAmount, as the bank want the saving account holder to maintain a minimum balance always. On each transaction, bank deduct 0.3% tax if the account holder if filer, if the account holder is not filer (not tax payer in the eyes of Government), the bank deduct 0.6% tax on…Which of the following statements are correct about the given code snippet? class A: def __init__(self, i = 0): self.i = i class B(A): def __init__(self, j = 0): self.j = j def main(): b = B() print(b.i) print(b.j) Group of answer choices Class B inherits A, but the attribute “i” in A is not inherited. Class B inherits A, thus automatically inherits all attributes in A. When you create an object of B, you have to pass an argument such as B(5). The attribute “j” cannot be accessed by object b. How many except statements can a try-except block have? Group of answer choices zero one more than one more than zerouse java to write code and please use treeset as mentioned in the question Create a class Customer with below attributes: int - id String - name String - dob double - salary String - email int - age Make all the attributes private.Create corresponding getters and setters. Create a constructor which takes all parameters in the above sequence. The constructor should set the value of attributes to parameter values inside the constructor. Create a class CustomerDemo with main method Create a static method sortCustomerOnId in the CustomerDemo class. This method has to take a list of Customer objects and return a TreeSet of Customer objects sorted based on id. Call the above method from the main method
- Using oop in java Create a class named “Rectangle” having length and width as attribute. There should be behaviorstoset the values of length and width (individually and collectively), and get their values individually. There should also bebehavior to display the perimeters and area of the rectangle. Create another class named as Main which hastwo objects of Rectangle (r1, r2) having length (3.2, 20) and width (4.5, 36) respectively. Also displaythe length, width, perimeter and area of both rectangles.I need to make a Java Application in Apache Netbeans 12.5 , I would like to ask for help please. The question is as follows: To encourage good grades, Hermosa High School has decided to award each student a bookstore credit that is 10 times the student’s grade point average. In other words, a student with a 3.2 grade point average receives a R 32 credit. Create a class that prompts a student for a name and grade point average, and then passes the values to a method that displays a descriptive message. The message uses the student’s name, echoes the grade point average, and computes and displays the credit. Save the application as BookstoreCredit.java.3- Create a class named Player with a default name as "player", a default level as 0, and a default class type of "fighter". Feel free to add any other attributes you wish! Create an instance method in the Player class called attack that takes another player as a parameter. This function should compare the level of the two players, and return whether the player won, lost, or tied. Finally create a loop that allows the user to input a name and a class type for two players; the level of both players should be determined at random (between 1 and 99). Print out the name and attributes of each player, and have the first player attack the second. Print whether the player won, lost, or tied. Ask if the user wants to try again. (Python code)
- please can u please write a java code for me Create a class called Citizen with the following attributes/variables:a. String citizenIDb. String citizenNamec. String citizenSurnamed. String citizenCellNumbere. int registrationDayf. int registrationMonthg. int registrationYear2. Create a class called Node with the following attributes/variables:a. Citizen citizen b. Node nextNode 3. Create a class called CitizenRegister with the following attributes/variables:a. Node headNodeb. int totalRegisteredCitizens4. Add and complete the following methods in CitizenRegister:a. head()i. Returns the first citizen object in the linked listb. tail()i. Returns the last citizen object in the linked listc. size()i. Returns the totalRegisteredCitizend. isEmpty()i. Returns the boolean of whether the linked list is empty or note. addCitizenAtHead(Node newNode)i. Adds a new node object containing the citizen object information before the headNodef. addCitizenAtTail(Node newNode)i. Adds a new node object…(Java) Create a class named Customer that will determine the monthly repayment amount due by acustomer for a product bought on credit. The class has five fields: customer name, contactnumber, product price, number of months and the monthly repayment amount. Write get and setmethods for each field, except for the monthly repayment amount field. The set methods mustprompt the user to enter the values for the following fields: customer name, contact number,product price and number of months. This class also needs a method to calculate the monthlyrepayment amount (product price divided by the number of months).Add a subclass named Finance_Period that will determine if a customer will pay interest or not. Ifthe number of months to pay for the product is greater than three, the customer will pay 25%interest, or else no interest applies. The maximum number of months to pay for the product is 12.Override the calculate_repayment() method by determining if the customer will pay interest ornot…Please help me with this assignment below. I already have the code, you just need to fix something or add something in the code as what the assignment below requests. The assignment: Continue Exercise •• P13.1, checking the words against the /usr/share/dict/words on your computer, or the words.txt file in the companion code for this book. For a given number, only return actual words. The code of the resource class: import java.util.Scanner; public class U10P01R{ // This method to returns a character array containing all possible keypad // encodings for a digit in a standard phone char[] keysForButton(int n) { switch (n) { case 0: return new char[] { ' ' }; case 1: return new char[] { '.' }; case 2: return new char[] { 'A', 'B', 'C' }; case 3: return new char[] { 'D', 'E', 'F' }; case 4: return new char[] { 'G', 'H', 'I' }; case 5: return new char[] {…