GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

Author Archives: Anonymous

Suppose Person also has a no‑argument constructor that sets…

Suppose Person also has a no‑argument constructor that sets name = “Unknown”. Write a Student no‑arg constructor that:·         Calls the no‑arg superclass constructor.·         Sets gpa to 0.0. public class Person {    private String name;        public Person() {        this.name = “Unknown”;    }     public Person(String name) {        this.name = name;    }     public String getName() {        return name;    }}public class Student extends Person {    private double gpa;     public Student(String name, double gpa) {        super(name);        this.gpa = gpa;    }     public double getGpa() {        return gpa;    }}

Read Details

In Java, the process of writing an object’s state to a file…

In Java, the process of writing an object’s state to a file is called [BLANK-1], and reading it back into memory is called [BLANK-2].

Read Details

21.   Define a simple class Course with: ·         Private f…

21.   Define a simple class Course with: ·         Private fields: String name, int credits. ·         A constructor Course(String name, int credits). ·         Getter methods for both fields.

Read Details

Write a Java statement that creates an ArrayList of Double n…

Write a Java statement that creates an ArrayList of Double named measurements and adds the value 3.14 to it.Show all work and proper Java syntax.

Read Details

Which of the following are true about inheritance in Java?

Which of the following are true about inheritance in Java?

Read Details

Can constructors be overloaded with the same parameter types…

Can constructors be overloaded with the same parameter types but different order?

Read Details

Write a for loop that computes and prints the sum of the int…

Write a for loop that computes and prints the sum of the integers from 1 to 100 (inclusive). Show all work and proper Java syntax.

Read Details

A subclass “is-a” specialized version of its superclass.

A subclass “is-a” specialized version of its superclass.

Read Details

Consider int[] nums = { 2, 4, 6, 8 };int sum = 0;for (int i…

Consider int[] nums = { 2, 4, 6, 8 };int sum = 0;for (int i = 0; i < nums.length; i++) {sum += nums[i];}System.out.println(sum); What is printed?

Read Details

Define a subclass named SavingsAccount that extends BankAcco…

Define a subclass named SavingsAccount that extends BankAccount. public class BankAccount {    private double balance;     public BankAccount(double initialBalance) {        balance = initialBalance;    }     public double getBalance() {        return balance;    }     public void deposit(double amount) {        balance += amount;    }}Requirements:Adds a private double field interestRateA constructor that takes initialBalance and interestRate, calls the superclass constructor to set the balance, and initializes interestRateA method applyMonthlyInterest that adds one month of interest to the balance. Assume interestRate is annual (e.g., 0.06 for 6% per year).Use a simple formula based on 12 months.

Read Details

Posts pagination

Newer posts 1 … 49 50 51 52 53 … 76,210 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top