import java.text.DecimalFormat; public class Ex0606 { public static void main (String args[]) DecimalFormat money = new DecimalFormat("$0.00 double hoursWorked = 50; double hourlyRate = 25; double grossPay = hoursWorked * hourlyRate; double deductions = grossPay * 0.2%3; double netPay = grossPay - deductions; System.out.printIn(money.format(grossPay)); System.out.printin(money.format(deductions)3; System.out.printin(money.format(netPay); %3D %3D %3D %3
Q: Use Java Programming Language Loan Account Class: Create class LoanAccount. Use a static variable…
A: The java code is given below.
Q: in java create a class shopping mall. It has Items with name, manufacturer and price. Provide…
A: public class Tester{ public static void main(String[] args) { //create instances of items Item…
Q: PROBLEM STATEMENT: Return a number, 1 greater than the given number. Can you write this assignment…
A: The answer is..
Q: Java program requirements: - a PesoCurrency class with an amount attribute. - Define an overloaded…
A: JAVA Program to create PesoCurrency with an amount attribute and a method to convert pesos to dollar…
Q: How do I code: public static int minValue(int[] arr) public static int minValue(int[] arr, int…
A: Answer: I have given answer in handwritten format. because just I have complete three function.
Q: Java --- Please help me understand further the code below by putting comments if possible in every…
A: First we have to understand the interface . Just like we have blueprint for any project development…
Q: A rational number is the quotient of two integers - the numerator and denominator. The denominator…
A: A rational number is defined as the number which contains two numbers called the numerator and…
Q: Write a pesudocode for the following code: public class EOM1 { public static void main(String[]…
A: The above java code is indicating a transaction between customer and the salesman. The customer buys…
Q: public class IncrementDecrement { public static void main (String[] args) { int number = 50; int…
A: Given: Run the following code. Write its output and also explain the output
Q: Write a SavingsAccount class for this Java program.
A: Find the following code
Q: Evaluate the JAVA code snippet below, then motivate why this is representative of good programming…
A: Good programming practices: The given code snippet is not an example of good programming practice…
Q: Write a JAVA program which consists of a single class called Calculator. This program will display a…
A: import java.util.Scanner;//to read inputpublic class Calculator{ //method to displaying menu…
Q: What is the error(s) in the following Java program? class Person{ public class Test{ int Age; public…
A: Following are the errors: 1. When the constructor is defined then we have passed a parameter with…
Q: problem description and answer all the questions about it: Problem Description: In the following…
A: Objective: This program modifies the given code and displays the bill using the factory design…
Q: Write a public static method named getStringTitleCased that takes in 1 argument of type String and…
A: The answer of this question is as follows:
Q: Computer Science Is there a way to rewrite this Java code differently? package application;…
A: The other way to write the above code is by not declaring the variables as private , so in that case…
Q: import java.text.DecimalFormat; public class Ex0605 { public static void main (String args[]) {…
A: Given: To find the output of given code.
Q: Enter the name of Stock: Oracle Corporation Enter the symbol of Stock: URCL Enter the previous…
A: The class containing the code for the specified problem is given below: import java.lang.Math;…
Q: Complete the following Java program so that it prompts the user for a series of numbers to determine…
A: The code is given below.
Q: Using the dialog boxes in the JOptionPane class, write a program that calculates and prints the…
A: The code for given problem: import javax.swing.JOptionPane;public class Payroll{ public static…
Q: The Body Mass Index – BMI is a parameter used to measure the health status of an individual. Various…
A: The Answer start from step-2.
Q: in java create a class shopping mall. It has Items with name, manufacturer and price. Provide…
A: Below are the executed snips, please follow code in sequence below. Here we are going to create…
Q: Error in my Java code! I am not getting the intended results, here are my two classes and output.…
A: import java.util.*;class XXX_Course { private String course_name; public static int count=999;…
Q: CreditCardTest.java: // Student Name Today's Date public class CreditCardTest { public…
A: The given code has two files "CreditCard.java" and "CreditCardTest.java". CreditCard.java: It is…
Q: Select the default constructor signature for a Student class. A. public Student( ) B. public void…
A: Language is one of the most widely used programming language which has been used to create different…
Q: Modify the command-line argument example Hello.java, to handle a few command-line arguments. Ask the…
A: Please find the answer below :
Q: ISP- Java A pedometer treats walking 2,000 steps as walking 1 mile. Write a program whose input is…
A: Algorithm: Start Implement a method stepsToMiles() which takes userSteps as input and returns…
Q: write code in java write a static method that will take in a lone integer parameter. this function…
A: Here, we are writing the complete program and the statements required are just highlighted as bold…
Q: In Java, I need help completing these two classes. //…
A: import java.util.Scanner; public class Student{ //declaring instance variables private String…
Q: in java 2.16 LAB: Driving cost - methods Write a method drivingCost() with input parameters…
A: logic:- calculate num_gallon=driven_miles/miles_per_gallon; calculate…
Q: Accumulating Totals in Single-Level Control Break Programs Summary In this lab, you will use what…
A: According to the information given:- we have to follow the instruction to get desired outcome.
Q: C1 write java program with class name Size. The program prompts the user to enter integer number,…
A: According to the Question below the complete Solution: Output:
Q: This is Java. This is a beginner course.
A: A Java program for the given criteria is as follows, //Create a class public class Finalgrade {…
Q: Q1: Write a java program that includes a method called Reader that reads unlimited number from the…
A: ANSWER:-
Q: Write an java application that allows a user to enter any number of student quiz scores, as…
A: Program: import java.util.*; class Main { public static void main(String args[]) { Scanner sc =…
Q: import javax.swing.JOptionPane; public class DebugTwo4 { // start main method public static void…
A: import javax.swing.JOptionPane; public class DebugTwo4 { // start main method public static void…
Q: In JAVA please help with the following: You are asked to write a discount system for a beauty…
A: Given requirement, Write a discount system for a beauty salon, which provides services and sells…
Q: 1.Is "balance" the same, yes or no, why? class CheckingAct{ . . . . private int balance; . . . .…
A: Please only post one part in one question. we are not allowed to solve more than one question in one…
Q: Debug this program to create the desired result attached in the picture. public class Library { //…
A: Here I have defined a static class named Book with one data member and constructor inside the class…
Q: basic java please Write a method called findTip that finds the value of a meal as a double…
A: In this code, a function named findTip is called in the main function and the tip is added to the…
Q: PROBLEM STATEMENT: Add two numbers together and return the resulting sum. public class…
A: To write java program to add two numbers together and return the sum.
Q: Please help me with these errors in java. Errors below public class Student { //student related…
A: Modified code: import java.util.Scanner;import java.sql.*; class Student { String studName;…
Q: 1 // Start with a penny 2 |/ double it every day 3 // how much do you have in a 30-day month? 4…
A: Java Code: public static void main (String[] args) throws java.lang.Exception { // your code…
Q: Program to compute interest = p * r * t, where p = $10K, rate = 6%, t = 10 years; these values are…
A: public class DisplayInterest { public static void main(String[] args) { double p = 10000, r = 0.06,…
Q: Write a Fraction class that works with the FractionMath program above. It should use your…
A: The given FractionMath Main Program is: //FractionMath class public class FractionMath {…
Q: package population.java; /** * * @author HP Laptop */ public class PopulationJava { private static…
A: package population.java; /**** @author HP Laptop*/ public class PopulationJava { private static…
Q: Write a java program that models a restaurant ordering system. You will need to have the following…
A: Algorithm: Start Implement a method displayMenu() to display given menu and ask the user to select…
Q: In Java: Write a program with total change amount in pennies as an integer input, and output the…
A: Program import java.util.*; public class Main { public static void main(String [] args) {…
Q: JAVA Create a class called Quadratic for representing a one-variable quadratic expression of the…
A: A quadratic equation is in the form of the a×x2+b×x+c=0 Where a,b, and c are the coefficients of the…
Step by step
Solved in 3 steps with 2 images
- in java 2.16 LAB: Driving cost - methods Write a method drivingCost() with input parameters drivenMiles, milesPerGallon, and dollarsPerGallon, that returns the dollar cost to drive those miles. All items are of type double. If the method is called with 50 20.0 3.1599, the method returns 7.89975. Define that method in a program whose inputs are the car's miles/gallon and the gas dollars/gallon (both doubles). Output the gas cost for 10 miles, 50 miles, and 400 miles, by calling your drivingCost() method three times. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:System.out.printf("%.2f", yourValue); The output ends with a newline. Ex: If the input is: 20.0 3.1599 the output is: 1.58 7.90 63.20 Your program must define and call a method:public static double drivingCost(double drivenMiles, double milesPerGallon, double dollarsPerGallon) Note: This is a lab from a previous chapter that now requires the use of a method.Use Java Programming Language Loan Account Class: Create class LoanAccount. Use a static variable annualInterestRate to store the annual interest rate for all account holders. Each object of the class contains a private instance variable principal indicating the amount the person is borrowing. Provide method: public double calculateMonthlyPayment(int numberOfPayments) to calculate the monthly payment by using the following formula: double monthlyPayment = principal * ( monthlyInterest / (1 - Math.pow(1 + monthlyInterest, -numberOfPayments))); where monthly interest = annualInterestRate/12. Provide a static method setAnnualInterestRate that sets the annualInterestRate to a new value. Set the initial loan amount (Principal) for a new loan through the constructor. Write a program to test class LoanAccount. Instantiate two LoanAccount objects, loan1 and loan2, with principal loan amounts of $5000.00 and $31000.00, respectively. Set annualInterestRate to 1%, then calculate the monthly…(Java) Question 3 Explain the answer step-by-step and include verbal explanation. Thank you! What will the following display to the console (don't run the code until you work it out by hand!) public class Person { String name; public Person(String name) { this.name = name; } public void printGreeting() { System.out.println("Hi, my name is, " + name + "!"); }}public class Student extends Person { double gpa; public Student(String name, double gpa) super(name); this.gpa = gpa; } public void printGreeting() { super.printGreeting(); System.out.println("My GPA of " + gpa + " is higher than yours!"); }}public class Test { public static void main(String[] args) { Person yan = new Person("Yan"); Person leann = new Student("Leann", 4.0); Student anh = new Student("Anh", 3.95); yan.printGreeting(); leann.printGreeting(); anh.printGreeting(); }}
- In JAVA please help with the following: You are asked to write a discount system for a beauty salon, which provides services and sells beauty products. It offers 3 types of memberships: Premium, Gold and Silver. Premium, gold and silver members receive a discount of 20%, 15%, and 10%, respectively, for all services provided. Customers without membership receive no discount. All members receive a flat 10% discount on products purchased (this might change in future). Your system shall consist of three classes: Customer, Discount and Visit, as shown in the class diagram. It shall compute the total bill if a customer purchases $x of products and $y of services, for a visit. Also write a test program to exercise all the classes. The class DiscountRate contains only static variables and methods (underlined in the class diagram). You should write JUnit tests for all your methods except constructors, getters and setters.package payroll2; // This program calculates an employee's take home pay. import javax.swing.JOptionPane; public class Payroll { private static double sum; private static double salary; private static double dependentDeduction; public static void main(String args[]) { { double salary; double numDependents; double dependentDeduction = salary * 0.025 * numDependents; double stateTax = salary * 0.065; double federalTax = salary * 0.28; double totalWithholding= stateTax + federalTax; double takeHomePay = salary - stateTax - federalTax + dependentDeduction; // Calculate state tax here. JOptionPane.showInputDialog("Enter Employee name: "); JOptionPane.showInputDialog("Enter Salary: ");//prompt…In C++ class rectangleType { public: void setLengthWidth(double x, double y); //Sets the length = x; width = y; void print() const; //Output length and width double area(); //Calculate and return the area of the rectangle (length*width) double perimeter(); //Calculate and return the perimeter (length of outside boundary of the rectangle) private: double length; double width; }; Print out the area of the rectangle.
- JAVA PROGRAM Chapter 7. PC #1. Rainfall Class Write a RainFall class that stores the total rainfall for each of 12 months into an array of doubles. The program should have methods that return the following: • the total rainfall for the year • the average monthly rainfall • the month with the most rain • the month with the least rain Demonstrate the class in a complete program. Main class name: RainFall (no package name) est Case 1 Enter the rainfall amount for month 1:\n1.2ENTEREnter the rainfall amount for month 2:\n2.3ENTEREnter the rainfall amount for month 3:\n3.4ENTEREnter the rainfall amount for month 4:\n5.1ENTEREnter the rainfall amount for month 5:\n1.7ENTEREnter the rainfall amount for month 6:\n6.5ENTEREnter the rainfall amount for month 7:\n2.5ENTEREnter the rainfall amount for month 8:\n3.3ENTEREnter the rainfall amount for month 9:\n1.1ENTEREnter the rainfall amount for month 10:\n5.5ENTEREnter the rainfall amount for month 11:\n6.6ENTEREnter…A rational number is the quotient of two integers - the numerator and denominator. The denominator cannot be zero. Two rational numbers can be added, subtracted, multiplied and divided. Write a java classRational for a rational number with the following specs: • A constructor that gets two integers (make sure the denominator is not 0).• The numerator and denominator should be private.• Getters: public int getNumerator() and public int getDenominator()• Setters: public void setNumerator(int n) and public void setDenominator(int d)• Public methods public Rational add(Rational r1), public Rational subtract(Rationalr1), public Rational multiply(Rational r1) and public Rational divide(Rational r1).• Printer function: public void print(). The number should be printed in the format n/d (numerator, forward-slash, denominator).JAVAclass: Main.java, Quadratic.java, TestQuadratic.java Create a class called Quadratic for representing a one-variable quadratic expression of the form: ax2 + bx + c a,b and c here are the coefficients. The class should contain the following methods: * A constructor that accepts values for a, b, and c. * public double getA() * public double getB() * public double getC() * public double evaluate (int x) * will return the value of the expression at point x * public double discriminant() - that will return (b2 - 4ac) * public boolean isImaginaryRoots() - roots are imaginary if (b2 - 4ac) < 0 * public boolean isRealRoots() - roots are real if (b2 - 4ac) >= 0 // these methods can only be invoked if the roots are not imaginary * public float firstRoot() * public float secondRoot() * public boolean isPerfectSquare(); // If the first and second roots are equal * Try to override the toString methods * Write a sample main program that will work as shown below. Example output:…
- Java 2 billBook -invoiceNumber: String-visitDate: String-patientName: String-paid: boolean -bills: bill[]-doctor: String +bill(all parameters)+Setters/getters methods(ifneeded)+printInvoice(): void +billBook(doctor:String,capacity:int)+Setters/getters methods (if needed)+addBills(): void+payBill(invoiceNumber: String): int Implement the class bill:a. Write the constructor that takes as parameters all data fields except the paid value. Abill object is by defauld not paid.b. The printInvoice() method should output the following information: The invoiceNumber, the visitDate, the name of the patient name A message “The bill is paid” or “The bill is not paid” according to the value of the field paid.2. Implement the class billBook using the above UML:a. Write the constructor that takes as parameters the name of the doctor who hasexamined the patient and the capacity which represents the size of the array bills.b. Write the method addBills that reads the information of bill objects from…JAVA PROGRAM Chapter 7. PC #1. Rainfall Class Write a RainFall class that stores the total rainfall for each of 12 months into an array of doubles. The program should have methods that return the following: • the total rainfall for the year • the average monthly rainfall • the month with the most rain • the month with the least rain Demonstrate the class in a complete program. Main class name: RainFall (no package name) HERE IS A WORKING CODE, PLEASE MODIFY THIS CODE SO THE PUBLIC CLASS IS MAIN AND WERE EVER THERE IS MAIN IN THE CHANGE IT SO IT RUNS. ALSO, MAKE SURE WHEN I UPLOAD THE CODE TO HYPERGRADE IT PASSES ALL THE TEST CASES. THANK YOU import java.util.Scanner;public class Main { private double[] rainfall = new double[12]; public Main(double[] rainfall) { this.rainfall = rainfall; } public double getTotalRainfall() { double total = 0.0; for(double rain : rainfall) { total += rain; }…in java create a class shopping mall. It has Items with name, manufacturer and price. Provide constructors. Getters, setters, toString methods. We add several items to Store. For that create a store class having name and array of items, Provide Constructors, getters/setters and toString(), in addition you have to provide a method add which add new item to the array. The main function that does these things looks as follows: Public static void main(Strings[] args) { Item shampoo2(“pantene”, “Procter & Gamble”,100), noodles(“Noodles”, “knorr”, 50); // add further items. Store abcSuperStore; abcSuperStore.add(shampoo2); abcSuperStore.add(noodles); … abcSuperStore.sale(shampoo2); a bcSuperStore.sale(noodles);