1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
nordsb [41]
3 years ago
7

Write a class called (d) Teacher that has just a main method. The main method should construct a GradeBook for a class with two

students, "Jack" and "Jill". Jack’s grades on the three tests for the class are 33, 55, and 77. Jill’s grades are 99, 66, and 33. After constructing the GradeBook object, main should use the instance methods of the GradeBook class to determine the name of the student with the highest average grades. Print the name of this student on the screen.
Computers and Technology
1 answer:
podryga [215]3 years ago
8 0

Answer:

The java program is given below.

import java.util.*;

class GradeBook  

{

//variables to hold all the given values

static int m11, m12, m13;

static int m21, m22, m23;

static String name1, name2;

//variables to hold the computed values

static double avg1, avg2;

//constructor initializing the variables with the given values

GradeBook()

{

name1 = "Jack";

m11 = 33;

m12 = 55;

m13 = 77;

name2 = "Jill";

m21 = 99;

m22 = 66;

m23 = 33;

}

//method to compute and display the student having highest average grade

static void computeAvg()

{

avg1=(m11+m12+m13)/3;

avg2=(m21+m22+m23)/3;

if(avg1>avg2)

System.out.println("Student with highest average is "+ name1);

else

System.out.println("Student with highest average is "+ name2);

}  

}

//contains only main() method

public class Teacher{  

public static void main(String[] args)

{

//object created

GradeBook ob = new GradeBook();

//object used to call the method

ob.computeAvg();

}

}

OUTPUT

Student with highest average is Jill

Explanation:

1. The class GradeBook declares all the required variables as static with appropriate data types, integer for grades and double for average grade.

2. Inside the constructor, the given values are assigned to the variables.

3. The method, computeAvg(), computes the average grade of both the students. The student having highest average grade is displayed using System.out.println() method.

4. Inside the class, Teacher, the main() method only has 2 lines of code.

5. The object of the class GradeBook is created.

6. The object is used to call the method, computeAvg(), which displays the message on the screen.

7. All the methods are also declared static except the constructor. The constructor cannot have any return type nor any access specifier.

8. The program does not takes any user input.

9. The program can be executed with different values of grades and names of the students.

You might be interested in
Play among us with me
omeli [17]

Answer:

cool

Explanation:oof

8 0
2 years ago
Read 2 more answers
There is no reason to study the works of famous photographers because they will make you less creative.
weeeeeb [17]
I think it is true because you may be ‘inspired’ by a famous artist but if you’re always being inspired by others its not 100% yours / you being creative
8 0
3 years ago
Read 2 more answers
Create a Card class that represents a playing card. It should have an int instance variable named rank and a char variable named
Helen [10]

Answer:

Explanation:

The following code is written in Java. It creates the Card class and then uses it to create a full house and print out the rank and suit of every card in that hand.

class Card {

   int rank;

   char suit;

   public Card(int rank, char suit) {

       this.rank = rank;

       this.suit = suit;

   }

   public int getRank() {

       return rank;

   }

   public char getSuit() {

       return suit;

   }

}

class CardTester {

   public static void main(String[] args) {

       Card card1 = new Card(3, '♥');

       Card card2 = new Card(3, '♠');

       Card card3 = new Card(3, '♦');

       Card card4 = new Card(2, '♦');

       Card card5 = new Card(2, '♣');

       System.out.println("Card 1: " + card1.getRank() + " of " + card1.getSuit());

       System.out.println("Card 2: " + card2.getRank() + " of " + card2.getSuit());

       System.out.println("Card 3: " + card3.getRank() + " of " + card3.getSuit());

       System.out.println("Card 4: " + card4.getRank() + " of " + card4.getSuit());

       System.out.println("Card 5: " + card5.getRank() + " of " + card5.getSuit());

   }

}

3 0
3 years ago
Which programming languages is best for game development? ​
kvasek [131]

Answer:

JavaScript. .

HTML 5.

SQL.

Python. .

Explanation:

hold it helps◕‿◕

3 0
2 years ago
How should you respond to the theft of your identity cyber awareness.
antiseptic1488 [7]

The way to respond to the theft of your identity cyber awareness is; To report the crime to the local commission which is the Federal Trade Commission (FTC).

<h3>Protection from Identity Theft</h3>

Identity Theft is basically a crime that happens happens when someone steals your personal information and uses it commit a fraudulent offence.

Now, the person that stole your identity may use the stolen information he got from you to apply for credit, file taxes, medical services or other government privileges.

The acts perpetuated above by the thief could lead to damage to your reputation with credit status and your good name too which could take years to rebuild.

Thus, it is very pertinent to report any case of such to the relevant government commission which in this case is Federal Trade Commission (FTC).

Read more about Identity Theft at; brainly.com/question/15252417

5 0
2 years ago
Other questions:
  • Checking the ___________ will reduce the possibility of having to rebuild or replace the engine.
    9·2 answers
  • Correspondence involves verbal communication. True False
    6·2 answers
  • The item that is clicked in a JList can be retrieved using the _____ method of JList.
    8·1 answer
  • Jason needs to design the colors for a web site that make it easy to read. Which should he consider using?
    9·1 answer
  • In the view that follows, which field can't be updated create view example_2 as select invoice_number, invoice_date, invoice_tot
    13·1 answer
  • Use a switch statement to display "one" if the user has entered 1, "two" if the user has entered 2, and "three" if the user has
    14·1 answer
  • Which of the following is NOT one of the Big 3 Google Applications that we discussed?
    9·2 answers
  • Discuss the DMA process​
    11·2 answers
  • Which of these is a negative effect of computer technology's role in creating
    9·1 answer
  • You are designing an exciting new adventure game and you want to attempt to explain where items that are carried by the player a
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!