
Sorry for the long and strange question, but this is supposed to be written in java;
CODE IN JAVA:
ServiceQuote.java file:
public class ServiceQuote {
private double partsCharge;
private double laborCharge;
public ServiceQuote() {
}
public ServiceQuote(double partsCharge, double
laborCharge) {
this.partsCharge =
partsCharge;
this.laborCharge =
laborCharge;
}
public double getPartsCharge() {
return partsCharge;
}
public void setPartsCharge(double partsCharge)
{
this.partsCharge =
partsCharge;
}
public double getLaborCharge() {
return laborCharge;
}
public void setLaborCharge(double laborCharge)
{
this.laborCharge =
laborCharge;
}
public double calcSalesTax() {
return this.partsCharge *
0.06;
}
public double calcTotalCharge() {
return this.partsCharge +
this.laborCharge + this.calcSalesTax();
}
}
TestSQ.java file:
public class TestSQ {
public static void main(String[] args) {
ServiceQuote sq = new
ServiceQuote();
sq.setPartsCharge(324.56);
sq.setLaborCharge(275);
System.out.printf("Sales Tax :
$%.2f\n", sq.calcSalesTax());
System.out.printf("Total charge :
$%.2f\n", sq.calcTotalCharge());
ServiceQuote sq2 = new
ServiceQuote(783.56, 250);
System.out.printf("Parts LCharge :
$%.2f\n", sq2.getPartsCharge());
System.out.printf("Labor Charge :
$%.2f\n", sq2.getLaborCharge());
System.out.printf("Sales Tax :
$%.2f\n", sq2.calcSalesTax());
System.out.printf("Total charge :
$%.2f\n", sq2.calcTotalCharge());
}
}
OUTPUT:

Sorry for the long and strange question, but this is supposed to be written in java;...
Question 2 (3 mark): Write a program to implement the class Coffee according to the following UML diagram and description so that it can display as the output example. Coffee -energy: double -protein: double -fat: double +Coffee +Coffee _energy: double, _protein: double. _fat: double) Coffee(sourceCup: Coffee) -printNutrition Information(): void +main(String[] args): void REQUIREMENTS The program has three constructors: the first one is a default constructor, it initializes the 3 data fields (50.0, 1.5, 1.7) at default; the second initializes the...
Java
Problem 2: Employee (10 points) (Software Design) Create an abstract class that represents an Employee and contains abstract method payment. Create concrete classes: SalaryEmployee, CommissionEmployee, HourlyEmployee which extend the Employee class and implements that abstract method. A Salary Employee has a salary, a Commision Employee has a commission rate and total sales, and Hourly Employee as an hourly rate and hours worked Software Architecture: The Employee class is the abstract super class and must be instantiated by one of...
using CSCI300 java Given the following UML Class Diagram Club_Card # card_num : String # name : String # age: int # year: int + Club_Card (all parameters) + Setters & Getters + toString() : String + equals(x: Object): boolean [10 pts] Define the class Club_Card, which contains: 1. All arguments constructor which accepts all required arguments from the main and instantiate a Club_Card object. 2. Set & get method for each data attribute. 3. A toString() method which returns...
The purpose of this is to use inheritance, polymorphism, object
comparison, sorting, reading binary files, and writing binary
files. In this application you will modify a previous project. The
previous project created a hierarchy of classes modeling a company
that produces and sells parts. Some of the parts were purchased and
resold. These were modeled by the PurchasedPart class. Some of the
parts were manufactured and sold. These were modeled by the
ManufacturedPart class. In this you will add a...
in java PART ONE ======================================= Below is the "RetailItem" class definition that we used in Chapter 6. Write a "CashRegister" class that leverages this "RetailItem" class which simulates the sale of a retail item. It should have a constructor that accepts a "RetailItem" object as an argument. The constructor should also accept an integer that represents the quantity of items being purchased. Your class should have these methods: getSubtotal: returns the subtotal of the sale, which is quantity times price....
Write a Java class called BankAccount (Parts of the code is given below), which has two fields name (String) and balance (double), two constructors and five methods getName(), getBalance(), deposit (double amount), withdraw(double amount) and toString(). The first constructor should initialize name to null and balance to 0. The second constructor initializes name and balance to the parameters passed. deposit method deposits the amount to the account causing the current balance to increase, withdraw method withdraws the amount causing the...
Write a Java class called BankAccount (Parts of the code is given below), which has two fields name (String) and balance (double), two constructors and five methods getName(), getBalance(), deposit (double amount), withdraw(double amount) and toString(). The first constructor should initialize name to null and balance to 0. The second constructor initializes name and balance to the parameters passed. deposit method deposits the amount to the account causing the current balance to increase, withdraw method withdraws the amount causing the...
Write a Java class named Employee to meet the
requirements described in the UML Class Diagram below:
Note: Code added in the toString cell are not usually included
in a regular UML class diagram. This was added so you can
understand what I expect from you.
If your code compiles cleanly, is defined correctly and
functions exactly as required, the expected output of your program
will solve the following problem:
“An IT company with four departments and a staff strength...
MAKE IT DIFFERENT WAYS TO RUN IT: Design an application for each of the following problems writing the pseudocode for each; include a UML diagram if appropriate. Be sure to follow the CSI 117 Style Criteria for naming conventions, class diagrams, pseudocode, keywords, and operators. 1. Wood Trim, Inc. wants a program that will allow its sales clerks to enter the length (in feet) of the trim ordered by a customer and the price of one foot of trim. Design...
Additional info is this will use a total of four classes Book,
BookApp, TextBook, and TextBookApp.
Also uses Super in the TextBook Class section.
Problem 1 (10 points) Вook The left side diagram is a UML diagram for Book class. - title: String The class has two attributes, title and price, and get/set methods for the two attributes. - price: double Вook) Book(String, double) getTitle(): String setTitle(String): void + getPrice() double setPrice(double): void toString() String + The first constructor doesn't...