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
Which scenario depicts an ethical workplace practice by a business owner
viva [34]

The answer is D. It's asking for the most UNETHICAL not ETHICAL, the answer before me was ETHICAL. Sharing personal data is UNETHICAL.

4 0
3 years ago
Read 2 more answers
With ______________, the cloud provider manages the hardware including servers, storage, and networking components. The organiza
EastWind [94]

Answer:

Infrastructure as a service

Explanation:

With infrastructure as a service, the cloud provider manages the hardware including servers, storage, and networking components. The organization is responsible for all the software, including operating system (and virtualization software), database software, and its applications and data.

7 0
3 years ago
After you have created at least four slides, a scroll bar containing scroll arrows and scroll boxes will appear on the right edg
neonofarm [45]

Answer:

I THINK THE ANSWER IS ''TRUE''

Explanation:

6 0
3 years ago
Mica's creating his web page with a software that is free of charge for the first month. If he likes the program, he will have t
Katarina [22]
The answer is C. Shareware
4 0
3 years ago
Read 2 more answers
On the basic of size, in how many groups do we classify the computers? Name them.<br>.​
Vedmedyk [2.9K]

Answer:

Computer can be classified into four categories based on size namely Micro, Mini, Mainframe and Super computer

Explanation:

8 0
3 years ago
Other questions:
  • Write a converter program for temperatures. This program should prompt the user for a temperature in Celsius. It should then con
    10·1 answer
  • Being tired has very similar effects on the body as what
    7·1 answer
  • Which is the first thing that would happen if a plant could NOT obtain carbon dioxide? A It would not be able to reproduce. B It
    5·1 answer
  • The function below takes a single argument: data_list, a list containing a mix of strings and numbers. The function tries to use
    6·1 answer
  • How has technology effected the way we communicate?
    5·1 answer
  • George works for a print newspaper in which of these areas would you be interested to hire new recruits for the newspaper WHICH
    11·1 answer
  • Please choose odd one out please tell fast ​
    13·2 answers
  • Please help me plss! PLS​
    8·2 answers
  • When you start a new, blank document, you usually end up changing the font to arial 11. 5 point. How can you make these settings
    8·1 answer
  • What does data warehousing allow organizations to achieve?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!