Write a subclass of Account as CheckingAccount. CheckingAccount class will have the additional variables and methods: - Instance variables: private int numOf_IssuedChecks -Constructors: initialize all instance variables (4pts) CheckingAccount(double initialBalance): CheckingAccount(double initialBalance, int numOf_IssuedChecks) -Instance methods: issueACheck(double amount)
Q: Create a program that will ask the user to enter a string Your task is replace the elements in the…
A: Hello Student. Warm welcome from my side. Hope you are doing great. I will try my best to answer…
Q: 1. What is wrong with the following condition? Correct it. if (grade > 70 || grade <= 80)
A: Conditions in java are used to pass through certain conditions.
Q: Clickzone Copy Center charges Php 15 for the first 10 copies, plus 0.75 per copy for the next 10…
A: The program is written in java import java.util.*;public class Main{ public static void…
Q: 2. Create a program that will display the following output using for(), while() and do-while()…
A: Import the java utility In main Class declare the variables m and n Get the m and n value from the…
Q: If class Apple extends class Fruit, which of the following is also true? O Fruit is the super class…
A: Correct Answer: - All of the above For Fruit is the super class of Apple It is correct because…
Q: You run four computer labs. Each lab contains computer stations that are numbered as shown in the…
A: JAVA PROGRAM: //Import the required package.import java.util.*; //Define the class.public class LAB…
Q: 1. Write a nested loop that displays 15 rows of '*' characters. There should be 30.'*' characters in…
A: As per the requirement program first program is developed. Note: As per our guidelines we are…
Q: Input: Operation to be made N number of inputs based on the operation Output: The calculator should…
A: First print all the menus. Read the choice of user and store in a character variable. If choice is…
Q: Software Requirements: Latest version of NetBeans IDE • Java Development Kit (JDK) 8 Procedure: 1.…
A: Program: import java.util.*;import java.io.*; public class Main{ public static void main(String[]…
Q: Draw a flowchart to sum the even numbers between 0 and 59.
A: Initialize a variable sum to zero.Iterate through numbers from 0 to 59.For each number, check if it…
Q: 1. Create a program that will display the following output using for(), while() and do-while()…
A: public class pattern { public static void main(String[] args) // main function {…
Q: Construct a class named TestCirde whose main() method dedares THREE (3) Cirde objects. Using the…
A:
Q: Your company's email server password changes must be verified by you. You don't think you changed…
A: What is Password: A password is a string of characters that provides authentication and access…
Q: Write an application that catches and throws an ArithmeticException when you attempt to take the…
A:
Q: Create a program that will compute for the area and perimeter of a rectangle using classes. You must…
A: length and width will be the variables of Rectangle class getArea() and getPerimeter() will be the…
Q: 15.7 (Telephone-Number Word Generator) Standard telephone keypads contain the digits zero through…
A: Introduction Inheritance: Inheritance is a crucial OOP concept (Object-Oriented Programming). The…
Q: Question Print Daily Company (PDC) needs a program that displays weekly salary. PDC has five…
A: Code with the OOP approach in JAVA is given below along with output
Q: Create a program that will ask the user to enter the elements of a 3 x 4 matrix. Your task is to…
A: Algorithm: Start Read a 3×4 matrix 'a' Initialize sum to 0 and count to 0 Iterate through the…
Q: The lucky number is the sequence number generated by the filter algorithm: if the number in the…
A: Step 1: Generate a list from 1 to size. 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,…
Q: Write an application that displays the multiplication table for numbers from 1 to 9. The table…
A: Java code: public class Main { //class public static void main(String[] args) { //main…
Q: Java programming
A: Program: //import the header file import java.util.Scanner; import java.text.DecimalFormat;…
Q: 10.14 (Project: Shape Hierarchy) Implement the Shape hierarchy shown in Fig. 9.3. Each Two-…
A: Solution: Given,
Q: Every cylinder has a base and height, where the base is a circle. Design the class Cylinder that can…
A: Actually, java is a object oriented programming language. It is a platform independent.
Q: Write a program that prompts the user to enter an integer from 1 to 15 and displays a pyramid, as…
A: import java.util.*;import java.lang.*;import java.io.*; class Codechef{ public static void main…
Q: In this chapter, the class Date was designed to implement the date in a program, but the method…
A: /* Java program to test class */ public class Date { // Instance variables int day;…
Q: Every circle has a center and a radius. Given the radius, we can determine the circle's area and…
A: public class Point{ double x, y;public Point(){setPoint( 0, 0 );}public Point(double x, double y…
Q: Write a method with the following header that returns a pentagonal number: public static int…
A: The nth pentagonal number pn is given by the formula: pn = (3n2 - n) / 2 for n >= 1.
Q: Implement a program that can input an expression in postfix notation (see Exer- cise C-6.19) and…
A: The program is written in Java. Check the program screenshot for the correct indentation. Please…
Q: FOR ALL PARTS, MAKE SURE YOUR METHODS ARE STATIC O PART 1: Method with Output O Define a method…
A: class MethodPractice{ public static void printHelloworld() {…
Q: Given the following: public class Beta extends Alpha{ Java syntax requires class Beta to have a…
A: False
Q: Write a method LinkedList joinLists (LinkedList list1, LinkedList list2) to join two linked lists…
A: Solution: Java code: import java.util.*; public class Test { /** * This method take two…
Q: Create a folder named LastName_FirstName in your local drive. (ex. Reyes_Mark) Using NetBeans,…
A: The program is written in Java. Please find the source code and output in the below steps.
Q: In this exercise, you will design various classes and write a program to computerize the billing…
A: Actually, java is a object oriented programming language. It is a platform independent.
Q: 14.13 (Tokenizing and Comparing Strings) Write an application that reads a line of text, tokeniz- es…
A: Code Sample Output
Step by step
Solved in 2 steps with 1 images
- Defining Classes Write and document the definition for the Money class. The Money class represents an amount in U.S. dollars. Money Class e Fields cents : int dollars : int e Methods getValue() : double Money(int d, int c) setCents(int c) : void setDollars(int d) : void toString() : String • Each Money object has two int instance variables: dollars and cents. • The class has one constructor that takes two int parameters. The first int represents whole dollars, and the second int represents cents. • The class has one accessor method named getValue() which returns the amount as a double. (Just divide cents by 100.0 and add it to dollars. Return that amount.) • The class has two mutator methods-setDollars() and setCents()–that modify the corresponding instance variables. • The class has a toString() method that returns the amount as a String in the form: $ 2345.75. Use concatenation to produce the output. Do not worry about the decimal places.Java - Calculator ClassPoint out errors in the following codes and correct them publicclass CheckingAccount { // Create attributes account Num, Balance privateint accountNum; // Account Number privatedouble balance; // Account balance // Constructor public void CheckingAccount(int aNum, double balance) { // Call setters to initialize attribute values setAccountNumber (aNum); setBalance; } // Setters public void setAccountNumber(int aNum) { if (accountNum >= 100) { accountNum = aNum; } else {System.out.println("This account number is invalid (Account number must be at least 3 digits)!"); this.accountNum = 100; // assign a default value } } public void setBalance(double aBalance) { // make sure the value is positive if (aBalance > 0) { aBalance = balance; } else { System.out.println("This balance value is invalid (input must be positive)!"); aBalance = 0; // assign a default value } } // Getters publicvoid getAccountNumber() { return accountNum; } public void getBalance() { return balance; }…
- Code: interface Bicycle{ //interface for bicycle void changeGear(int val); //abstract methods void changeSpeed(int inc); void applyBrakes(int dec); void ringBell(int count); } class NewCycle implements Bicycle{ //class for a new cycle int speed=0; //stores the speed value int gear=0; //stores the gear value @Override public void changeGear(int val) { //method to change the gear gear=val; } @Override public void changeSpeed(int inc) { //method to change the speed speed=speed+inc; } @Override public void applyBrakes(int dec) { //method to apply brakes speed=speed-dec; } @Override public void ringBell(int count) { //method to ring the bell for(int i=0;i<count;i++){ System.out.print("Clang!!"+" "); } System.out.println(""); } public void printState(){ //method to print the states System.out.println("Ring bell, Speed, Gear,…Code the StudentAccount class according to the class diagramMethods explanation:pay(double): doubleThis method is called when a student pays an amount towards outstanding fees. The balance isreduced by the amount received. The updated balance is returned by the method.addFees(double): doubleThis method is called to increase the balance by the amount received as a parameter. The updatedbalance is returned by the method.refund(): voidThis method is called when any monies owned to the student is paid out. This method can onlyrefund a student if the balance is negative. It displays the amount to be refunded and set thebalance to zero. (Use Math.abs(double) in your output message). If there is no refund, display anappropriate message.Test your StudentAccount class by creating objects and calling the methods addFees(), pay() andrefund(). Use toString() to display the object’s data after each method calledDesign/code/test a Java program containing an abstract the class absWelcome. This class should contain: 1. A public abstract void method (you name it) that is empty 2. A public regular method (you name it) that prints "Welcome to " Next, create a subclass clsHello that extends absWelcome. This class should contain: • A public regular method (you name it) that prints "Java Programming" Finally, inside the Main class create an object (you name it) from the clsHello class. Use this new object reference to: 1. Output "Welcome to " from the abstract class 2. Output "Java Programming" from the subclass Your output should resemble that shown below >sh -c javac -classpath -type f-name '*.java') java -classpath :targe Welcome to Java Programming
- 7. public class Father { public String name; public int age; // customer name Father(){ name="Hassan"; age=50;} public void display(){ System.out.println("Name:"+name); System.out.println("Age:"+age); }} Figure 3 i. Based on Figure 3, create a class named Child that inherits the Father class. Declare an instance name location (String) for class Child. ii. Define a constructor in class Child and give an appropriate initial values for the instance (name, age, location). Define a method display () in class Child, execute the display () method in superclass using the keyword super. Method display () in class Child should print the information of name, age and location. ii.public class Artwork { // TODO: Declare private fields - title, yearCreated // TODO: Declare private field artist of type Artist // TODO: Define default constructor // TODO: Define get methods: getTitle(), getYearCreated() // TODO: Define second constructor to initialize // private fields (title, yearCreated, artist) // TODO: Define printInfo() method // Call the printInfo() method in Artist.java to print an artist's information }} public class ArtworkLabel { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); String userTitle, userArtistName; int yearCreated, userBirthYear, userDeathYear; userArtistName = scnr.nextLine(); userBirthYear = scnr.nextInt(); scnr.nextLine(); userDeathYear = scnr.nextInt(); scnr.nextLine(); userTitle = scnr.nextLine(); yearCreated =…Create an Employee Class that will have Two instance variable: name and workingPeriod A class method named employeeByJoiningYear(): • To create an Employee object by joining year for calculating the working period o it will have two Parameter name and year • A static method experienceCheck() to check if an Employee is experienced or not o It will take working period and gender as parameter o If an employee's working period is less than 3, he or she is not experienced [You are not allowed to change the code below] # Write your code here employee1 = Employee('Dororo', 3) employee2 = Employee.employeeByJoiningYear('Harry', 2016) 6 print(employee1.workingPeriod) print(employee2.workingPeriod) print(employee1.name) print(employee2.name) print(Employee.experienceCheck(2, "male")) print(Employee.experienceCheck(3, "female")) Оutput 3 Dororo Harry He is not experienced She is experienced
- Given the following super class and subclasses: public abstract class ThemePark String name: // customer's name String icNo: // customer's identification card number boolean member: // either member or nonmember of the // theme park //Methods: //default and normal constructor //accessors //toString0 public abstract double calCharges0: //calculate the charges public class WaterPark extends ThemePark String activity: // surfBeach,waterRide or other //Methods: //default and normal constructor //accessors /toString0 public double calCharges) . public class WildlifePark extends ThemePark String category: //child or adult I/Methods: //default and normal constructor //accessors /toString) public double calCharges) .) b) Write code fragments in the application / driver class that can perform the following tasks: (Assume all relevant methods have been defined in all classes involved) ii) Assuming data has been stored in this tp array, calculate and display the total charges of every WaterPark…Data StructuresGiven the following super class and subclasses: public abstract class ThemePark String name: // customer's name String icNo: // customer's identification card number boolean member: // either member or nonmember of the // theme park I/Methods: //default and normal constructor //accessors //toStringo public abstract double calCharges0: //calculate the charges public class WaterPark extends ThemePark String activity: // surfBeach,waterRide or other //Methods: //default and normal constructor //accessors //toString0 public double calCharges() public class WildlifePark extends ThemePark String category: //child or adult //Methods: //default and normal constructor //accessors //toString) public double calCharges) .) a) Write the following method definition (the coding): i) Normal constructor for both subclasses. 2014 - 2021