Question: Object oriented programming subject Urgent, need answer in 20 minutes please. thank you 1. Determine the scope of the following: 1. For the class Account
Object oriented programming subject


Urgent, need answer in 20 minutes please. thank you
1. Determine the scope of the following: 1. For the class Account in Fig. Q1(1)(1). a) Instance variable name (1 marks) b) Variable depositAmount (2 marks) 11. For the class ClassAverage in Fig. Q1(1)(11). a) Variable gradeCounter (2 marks) b) Variable average (2 marks) 1 public class Account 2 { private String name; // instance variable private double balance; // instance variable // Account constructor that receives two parameters public Account(String name, double balance) { this.name = name; // assign name to instance variable name 81 9 10 11 12 13 1 15 16 // validate that the balance is greater than 0.0; if it's not, // instance variable balance keeps its default initial value of 0.0 if (balance > 0.0) // if the balance is valid this.balance - balance; // assign it to instance variable balance } // method that withdraws (deduct) only a valid amount to the balance public void withdraw(double withdrawalAmount) { if (withdrawalAmount 0.0) il if the depositAmount is valid balance - balance + depositAmount; // add it to the balance } 34 35. 36 methou mets the cenunt balance public double getBalance() returu balance; 7 33 39 or on method that sets the name public void setName(String name) 11 42 this.name name; 46 47 para method thirt metumas the name public String getName() return name; 1 50 151 52 53 $7 method that returns the name public void accountsummary() 55 56 System.out. orintf("Name: xsxn Balance: $% 25%n", getName(), getBalance(): / end class Account Fig. Q1(1)(1) . 2 o 4.8: ClassAverage.java // Solving the class-average problem using counter-controlled repetition, import java.util.Scanner; progran uses class Scanner public class ClassAverage 7 & public static void main(String[] ares) create Scanner to obtalo input from coscand window Scanner input = new Scanner(Systen. in): 12 13 initialization phase int total = 0: Initialize of grades antenes by the user int gradeCounter = 1; initialize # of grade to be entered next 16 17 v processing phase uses counter-controlled repetition while grade Counter
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
