A bank account earns interest once per year. Compute the interest earned in the first and second years. Investment.java 1 public class Investment 2 { 3 4 5 public static void main(String[] args) { double balance = 351.75; double percent = 5.5; 7 8 double interest = balance percent; System.out.printf("Year 1 interest: %.2f%n", interest); 9 10 11 12 interest = balance percent; 13 14 15 } System.out.printf("Year 2 interest: %.2f%n", interest); }
Q: Java Questions - (Has 2 Parts). Based on each code, which answer out of the choices "A,B,C,D,E" is…
A: Both of these questions from the inheritance part of the java. The second question is giving the…
Q: Java --- Please help me understand further the code below. Thank you!| --- Circle.java public class…
A: ALGORITHM: Step 1: Create an interface Shape Step 2: In that create 4 classes circle, rectangle,…
Q: Note: The below Java program consists of multiple source files. Click on the "CallPerson.java" or…
A: The output is, You are Ann Wayne I am Bob Rogers Observe the below screenshot
Q: Write, Compile and Execute a Java method that computes whether a given number is happy or sad.
A: public static int HappyNumber(int num){ int rem = 0, sum = 0;…
Q: Write java program that has two class the main class and calculator class. The program receive two…
A: /* package codechef; // don't place package name! */ import java.util.*;import java.lang.*;import…
Q: What will be the output of the following Java Program? // file name: Main.java public class…
A: In this question, a JAVA piece of code is given and we are asked to output the program. Given code :…
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: (Java) 7.2 Code: Look at the following Person.java class code: class Person{ public String name;…
A: The toString() method is a method in java that is used to print or output the values of an object or…
Q: Instructions InchConversion.java 1 import java.util.Scanner; 2 public class InchConversion { public…
A: Actually, Java is a high level programming language. And also object oriented . It. Is a platform…
Q: Implement the following classes in Java. Date class which has day(int), month(int) and year(int)…
A: Total 5 classes needs to be maid one each for date, time, datetime, pizzaorder and test class. Date…
Q: Write a SavingsAccount class for this Java program.
A: Find the following code
Q: 1) Show and explain the output in Java program below: public class Exercisel { public static void…
A: According to the Question below the solution: Output:
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: Code is in Java find the error in the following class definition: public class MyClass {…
A: public void MyClass(int a, double b) The Above Line Is Incorrect. There Won't be any Return Type…
Q: public class output{ public static int find (int a1, int a2) { if(a1==0) return(a1+1); else if(a1>0…
A: There is a class output in which two method are there find and main. Find method is recursively…
Q: In Java, using a single method. Seperate every warning message by a blank line. Write a program…
A: Answer: Java Source Code: public class Main{ public static void main(String[] args) {…
Q: public class output{ public static int check (int a, int b, int c) { if(a==0) return (b); else if…
A: Given:
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: JAVA PROGRAM A bank offers a 3% interest per annum for savings accounts. The bank also has 1%…
A: A bank account is a ledger that is gainful for salaried people or those with a customary month to…
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: 1. Class Human: a. Fields: age (int), weight (double), height (double) b. Methods: getAge,…
A: Answer: Below is the solution to the problem in Java:
Q: eSenior = 3; } Answer these questions according to the UML class schema and the code given above.…
A: [JAVA] public class FlightRules {public final static int minHostessCount = 2;public final static int…
Q: 4. Write a Java program that generates an isosceles triangle made of asterisks. The program should…
A: - We need to highlight the java code for a hollow isosceles triangle.
Q: Question public class MyProgram ( public static void main(String[] args) { int h=10, t-22;…
A: Answer the above question are as follows:
Q: Given the below class: public class Dog { private String name; private double weight;…
A: 1.) Class : Dog public class Dog { private String name; private double weight; private…
Q: public class FindTheError { public int square(int number) { return number *…
A: Hi. Let's move on to the solutions in next step.
Q: (Java) Question 3 Explain the answer step-by-step and include verbal explanation. Thank you!…
A: EXPLANATION: The first object is created of Person class and the constructor is called by passing…
Q: public class JavaApplication7 { public static void main(String [] args) { //TODO - write your own…
A: public class Main{ public static void main(String[] args) { //testing method…
Q: public class Main5 public static void main(String] args) { int a = 5; int b = 6, float c = alb,…
A: The answer is as follows:-
Q: *** Complete in Java Program** Use Gambler's Ruin Example Gambler's ruin. Suppose a gambler makes…
A: First you need to know that what is gambler's Ruin problem : Card shark's Ruin ProblemConsider a…
Q: Please correct the error, I don't know where I mistake. currently it says I've mistake at…
A: Given: Please correct the error, I don't know where I mistake. currently it says I've mistake at…
Q: Starting Out with Java From Control Structures through Objects 6th Edition 4. Paint Job Estimator…
A: Actually, given information: A painting company has determined that for every 115 square feet of…
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: JavaProblem 2-4 Pennies Problem Problem 2-4. Pennies Problem. Here’s an old problem. Today, I’ll…
A: GIVEN: Pennies Problem.
Q: public class ReportSum { public static void main(String args[]) { //assume we have 2 numbers a and…
A: Here I have created a function named sum2Numbers(). In this function, I have calculated the sum of…
Q: WRITE THE OUTPUTS OF THE FOLLOWING!!! A.) public class MyClass { static void myMethod() {…
A: JAVA supports the properties of encapsulation and data hiding through the creation of user-defined…
Q: Programming Exercise 3-6 Instructions BookstoreCredit.java 1 import java.util.Scanner; 2 public…
A: As given, we need to write a Java program that takes student's name and gpa as input and pass those…
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: Write a simple cash register class. (Use Java) Each cash register should keep track of the number…
A: ############################################################## The code for your class is given…
Q: 1. Write a program in Java that should do the following: a. Prompt the user to enter 3 grades…
A: logic:- multiply any of integer by 1.0 so that average method returns double value . read a, b…
Q: Based on the java source code given , how can i add a simple payment system in the code. Please…
A: Errros
Q: Support computing sales tax in the CashRegister class. The tax rate should be supplied when…
A: Note: you have not provided CashRegisterTester.java class file. so, we cannot provide compiled code…
Q: 3. Write a java program as in the next class diagram, such as: SimpleCalc2 SimpleCalc2() method only…
A: ALGORITHM:- 1. Create class SimpleCalc2(). 2. Define all the member functions inside it. 3. Test the…
Q: Write a java program Problem 1: Design a class named Student to represent a student information. The…
A: 1. create a class student.2. declare all variables.3. also create a constructor to initialize…
Q: Java Questions - (Has 2 Parts). Based on each code, which answer out of the choices "A, B, C, D, E"…
A: Answer:
Q: 1. Write a Java method overloading to compute the value of the future invest- ment at a given…
A: I have provided JAVA CODE along with CODE SCREENSHOT and OUTPUT SCREENSHOT---------------
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: 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: 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: The question is attached to the image. Please help!
A: Create and initialize the final variable windowWidth and windowheigth. Calculate window area. int…
A bank account earns interest once per year. Compute the interest earned in the first and second years.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
- Please help me solve this with java .... just the HangMan HangMan instruction class : • HangMan is a game in which a player tries to guess a word based on a given hint. For example, if the given hint is “movie”, then the player must guess a movie name. If the given hint is a “country”, then the player must guess a country name, and so on.• The game starts by showing a message on the screen that shows the hint and all letters in the word but obscured as dashes (-). Then, the game will allow the player to guess 5 letters. If the player gives a letter that actually exists in the word, then this letter will be revealed. Afterwards, the game will ask the player to give the answer. If the given answer is correct, then the game will show a message that the player has won 5 points. Otherwise, the game will show a message that the player has lost. Below is one possible game scenario, in which the word is “iron man”, and the hint is “movie”. Note that the text in green color is the…// SuperMarket.java - This program creates a report that lists weekly hours worked // by employees of a supermarket. The report lists total hours for // each day of one week. // Input: Interactive // Output: Report. import java.util.Scanner; public class SuperMarket { public static void main(String args[]) { // Declare variables. final String HEAD1 = "WEEKLY HOURS WORKED"; final String DAY_FOOTER = " Day Total "; // Leading spaces are intentional. final String SENTINEL = "done"; // Named constant for sentinel value. double hoursWorked = 0; // Current record hours. String hoursWorkedString = ""; // String version of hours String dayOfWeek; // Current record day of week. double hoursTotal = 0; // Hours total for a day. String prevDay = ""; // Previous day of week. boolean done = false; // loop control Scanner input = new…(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(); }}
- Java Questions - (Has 2 Parts). Based on each code, which answer out of the choices "A,B,C,D,E" is correct. Each question has one correct answer. Thank you. Part 1 - 3. Given the following code, the output is __. class Base { private int x = 5; }class Derived extends Base { x = 6; }public class Sample { public static void main(String[] args) { int x = 7; Derived d1 = new Derived(); System.out.print(d1.x); }} A. 0B. 5C. 6D. 7E. Error message Part 2 - 4. A class Animal has a subclass Mammal. Which of the following is true? A. class Animal extends Mammal { }B. class Mammal extends Animal { }C. class Animal implements Mammal { }D. class Mammal implements Animal { }E. class Mammal { Animal a1 = new Animal(); }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).A supermarket awards coupons depending on how much a customer spends on groceries. For example, if you spend $50, you will get a coupon worth eight percent of the amount. The following table shows the percent used to calculate the coupon awarded for different amounts spent. Write a JAVA program that calculates and prints the value of the coupons a person can receive based on groceries purchased. Money Spent Coupon Percentage Less than 10$ No coupon $10-$59 8% $60-$149 10% $150-$209 12% $210 or more 14% Here is a sample run: Please enter the cost of your groceries: 14 You win a discount coupon of $1.12. (8% of your purchase)
- IN JAVA Look at the following class definition: public class Dog {private int age = 0; // age is given in years, the default value is 0private String name = "Fido"; // default name is FidoDog(String firstName, int firstAge) {name = firstName;age = firstAge;if (age < 0) {age = 0;}}public void setName(String newName) {name = newName;}public int getAge() {return age;}public String getName() {return name;}public void haveBirthdayParty() {age = age + 1;System.out.println("Happy birthday " + name + "! You are now " + age + " years old!");}public void printInfo() {System.out.println("This dog's name is " + name + " and he's " + age + " years old!");}} Make a post containing your answers to all of the questions below: Can you create a new dog without specifying its name? Why or why not? Which of the Dog class's methods are accessors? Which ones are mutators? Can you use the methods provided to make a dog younger? (In other words, can you set age to a lower value than it already was?)…import java.util.*; public class CardGame { static Scanner scanner = new Scanner(System.in); static Random random = new Random(); public static void main(String[] args) { System.out.println("Welcome to the card game! Here are the instructions:"); System.out.println("- You will randomly draw a card from a deck of 52 cards."); System.out.println("- The computer will also draw a card from the same deck."); System.out.println("- If your card has a higher face value, you win. Otherwise, you lose."); System.out.println("- If your card has the same face value as the computer's card, the suit determines the order."); int gamesPlayed = 0; int userWins = 0; int computerWins = 0; boolean[] cards = new boolean[52]; // false means the card is available, true means it's been drawn while (true) { System.out.println("\nNew game!"); int[] userCard = drawCard(cards); int[]…In Java please.Enter the code where it says " /* Your code goes here */ ". Suppose we add a fixed amount of money into our bank account at the beginning of every year. Modify the program from this section to show how many years it takes for the balance to double, given the annual contributions and the interest. import java.util.Scanner;/** This program computes the time required to double an investment with an annual contribution.*/public class DoubleInvestment{ public static void main(String[] args) { final double RATE = 5; final double INITIAL_BALANCE = 10000; final double TARGET = 2 * INITIAL_BALANCE; Scanner in = new Scanner(System.in); System.out.print("Annual contribution: "); double contribution = in.nextDouble(); double balance = INITIAL_BALANCE; int year = 0; // TODO: Add annual contribution, but not in year 0 /* Your code goes here */ System.out.println("Year: " + year); System.out.printf("Balance:…
- Complete the following Java program so that it prompts the user for a series of numbers to determine the smallest value entered. import java.util.Scanner; public class FindMin{ public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); int smallest = Integer.MAX_VALUE; // largest int int userInput; System.out.println("This program finds the smallest number" + " in a series of numbers"); System.out.println("When you want to exit, type Q"); // *** ADD CODE HERE System.out.println("The smallest number is " + smallest); } // end main method } // end class FindMinThis needs to be done in Java! (Sales Commission Calculator) A large company pays its salespeople on a commission basis. The salespeople receive $200 per week plus 9% of their gross sales for that week. For example, a salesperson who sells $5,000 worth of merchandise in a week receives $200 plus 9% of $5,000, or a total of $650. You’ve been supplied with a list of the items sold by each salesperson. The values of these items are shown below. Develop a Java application that inputs one salesperson’s items sold for last week and calculates and displays that salesperson’s earnings. There’s no limit to the number of items that can be sold. Item Value 1 239.99 2 129.75 3 99.95 4 350.89 Example Output: Enter number sold of product #1: 10Enter number sold of product #2: 20Enter number sold of product #3: 30Enter number sold of product #4: 40Earnings this week: $2182.61 NOTES: Do not create a separate class for this program. Create the…Java---Please help me understand further the code below by putting comments if possible in every line. Thank you!---Circle.java public class Circle implements Shape { final float PI = 3.14f; int radius; public Circle(int radius) { this.radius = radius; } @Override public double getPerimeter() { return(2 * PI * radius); } @Override public double getArea() { return(PI * radius*radius); } @Override public void getDetails() { System.out.println("Type: Circle"); System.out.println("Radius: " + radius); System.out.printf("Perimeter: %.1f\n", getPerimeter()); System.out.printf("Area: %.1f\n", getArea()); } } Rectangle.java public class Rectangle implements Shape {…