Question JAVA thanks AUT COMP503/ENSE502/ENSE602:02 - Exercises Exercise 4 Complete the following methods in the Person class //returns true if this person is a student and false otherwise public boolean isStudent () return false; } //returns the age of the Person public int getAge() return 0; } //returns 50 if this person is a student between the age of 10 and 20 (inclusive) public int computeDiscount Percent() return 0; } AUT COMP503/ENSE502/ENSE602:02 - Exercises Exercise 6 Design the CartesianPoint class with instance variables to store coordinates of a two dimensional point (x,y) on the Cartesian plane. The coordinates may be given as floating point values. Write a constructor which takes as input the x and y coordinates Write a default constructor which initialises the point coordinates to zero Create the method double distance From(Cartesian Point q) returns the Euclidean distance between this point and input point q using the following equation (x2 - x)2 + (y2 - y.) You will need to use methods contained within the Math library. Write a method to return true if this point lies on the x-axis and false otherwise Write a method to return true if this point lies on the y-axis and false otherwise AUT COMP503/ENSE502/ENSE602:02 - Exercises Exercise 7 Design the BankAccount class with instance variables for the customer's name and the current balance of their bank account. Create a constructor which takes as input the customer's name and initialises their bank account balance to 0.0. Write the following methods • void withdraw(int amount), decreases the input amount from the customer's balance, if there is enough money in the account void deposit(int amount) increases the customer's bank account balance. If the input amount is a negative number then the balance does not change • void borrow(int amount) decreases the customer's bank account according to the amount borrowed (including 10% interest), even if the customer does not have enough money. E.g. if amount=100 then the total withdrawn from the account is 100+100*0.10 = 110. Create a CashPoint class with a main method and use the Scanner class to develop an interactive interface to demonstrate all functionality of the BankAccount class and output the balance after each transaction. For this exercise, you do not need to consider incorrect non-numerical inputs.

MR0E08 The Asker · Computer Science

JAVA thanks

Transcribed Image Text: AUT COMP503/ENSE502/ENSE602:02 - Exercises Exercise 4 Complete the following methods in the Person class //returns true if this person is a student and false otherwise public boolean isStudent () return false; } //returns the age of the Person public int getAge() return 0; } //returns 50 if this person is a student between the age of 10 and 20 (inclusive) public int computeDiscount Percent() return 0; } AUT COMP503/ENSE502/ENSE602:02 - Exercises Exercise 6 Design the CartesianPoint class with instance variables to store coordinates of a two dimensional point (x,y) on the Cartesian plane. The coordinates may be given as floating point values. Write a constructor which takes as input the x and y coordinates Write a default constructor which initialises the point coordinates to zero Create the method double distance From(Cartesian Point q) returns the Euclidean distance between this point and input point q using the following equation (x2 - x)2 + (y2 - y.) You will need to use methods contained within the Math library. Write a method to return true if this point lies on the x-axis and false otherwise Write a method to return true if this point lies on the y-axis and false otherwise AUT COMP503/ENSE502/ENSE602:02 - Exercises Exercise 7 Design the BankAccount class with instance variables for the customer's name and the current balance of their bank account. Create a constructor which takes as input the customer's name and initialises their bank account balance to 0.0. Write the following methods • void withdraw(int amount), decreases the input amount from the customer's balance, if there is enough money in the account void deposit(int amount) increases the customer's bank account balance. If the input amount is a negative number then the balance does not change • void borrow(int amount) decreases the customer's bank account according to the amount borrowed (including 10% interest), even if the customer does not have enough money. E.g. if amount=100 then the total withdrawn from the account is 100+100*0.10 = 110. Create a CashPoint class with a main method and use the Scanner class to develop an interactive interface to demonstrate all functionality of the BankAccount class and output the balance after each transaction. For this exercise, you do not need to consider incorrect non-numerical inputs.
More
Transcribed Image Text: AUT COMP503/ENSE502/ENSE602:02 - Exercises Exercise 4 Complete the following methods in the Person class //returns true if this person is a student and false otherwise public boolean isStudent () return false; } //returns the age of the Person public int getAge() return 0; } //returns 50 if this person is a student between the age of 10 and 20 (inclusive) public int computeDiscount Percent() return 0; } AUT COMP503/ENSE502/ENSE602:02 - Exercises Exercise 6 Design the CartesianPoint class with instance variables to store coordinates of a two dimensional point (x,y) on the Cartesian plane. The coordinates may be given as floating point values. Write a constructor which takes as input the x and y coordinates Write a default constructor which initialises the point coordinates to zero Create the method double distance From(Cartesian Point q) returns the Euclidean distance between this point and input point q using the following equation (x2 - x)2 + (y2 - y.) You will need to use methods contained within the Math library. Write a method to return true if this point lies on the x-axis and false otherwise Write a method to return true if this point lies on the y-axis and false otherwise AUT COMP503/ENSE502/ENSE602:02 - Exercises Exercise 7 Design the BankAccount class with instance variables for the customer's name and the current balance of their bank account. Create a constructor which takes as input the customer's name and initialises their bank account balance to 0.0. Write the following methods • void withdraw(int amount), decreases the input amount from the customer's balance, if there is enough money in the account void deposit(int amount) increases the customer's bank account balance. If the input amount is a negative number then the balance does not change • void borrow(int amount) decreases the customer's bank account according to the amount borrowed (including 10% interest), even if the customer does not have enough money. E.g. if amount=100 then the total withdrawn from the account is 100+100*0.10 = 110. Create a CashPoint class with a main method and use the Scanner class to develop an interactive interface to demonstrate all functionality of the BankAccount class and output the balance after each transaction. For this exercise, you do not need to consider incorrect non-numerical inputs.
Community Answer
OH8RWD

Excericse 6-----------------Code-------------/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */package chegg1;import java.util.Scanner;/** * * @author vijay */class CartesianPoint{ double x,y; CartesianPoint(double x,double y){ this.x=x; this.y=y; } CartesianPoint(){ x=0; y=0; } double distanceFrom(CartesianPoint q){ double ans=Math.sqrt((x-q.x)*(x-q.x)+(y-q.y)*(y-q.y)); return ans; } boolean IsOnXaxis(){ if(y==0)return true; return false; } boolean IsOnYaxis(){ if(x==0) return true; return false; } }public class Chegg1 { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here Scanner sc=new Scanner(System.in); System.out.println("Enter the x and y coordinate"); double x,y; x=sc.nextDouble(); y=sc.nextDouble(); CartesianPoint point1=new CartesianPoint(x,y); System.out.println("Enter the x and y coordinate"); x=sc.nextDouble(); y=sc.nextDouble(); CartesianPoint point2=new CartesianPoint(x,y); System.out.println("distance between two points is: "+point1.distanceFrom(point2)); } }------------------------Output------------run:Enter the x and y coordinate15Enter the x and y coordinate24distance between two points is: 1.4142135623730951BUILD SUCCESSFUL (total time: 3 seconds)Excercise 7---------------Code----------------------/* * To change this license header, choose License Headers in Project Properties. * To chan ... See the full answer