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
What is the output of adding 1001011 and 100000?
Otrada [13]
1101011, 0x6B or 0153
7 0
3 years ago
Which CIDR network has the smallest possible number of hosts? a. 123.0.0.0/8 b. 123.45.0.0/16 c. 123.45.67.0/24 d. All have the
Lina20 [59]

Answer:

CIDR is based on a variable-length subnet masking technique, which allows a new method of representation for IP addresses. Routing prefix is written with a suffix number of bits of the name, such as 123.0.0.0/8, as the CIDR network has the smallest possible amount of hosts.

Explanation:

CIDR ( Class Inter-Domain Routing ) It is a method that is allocating IP addresses and routing the IP. CIDR is introduced in 1933 and replace the architecture of network design on the internet. CIDR slows down the growth of the routing across the web and helps to slow the IP addresses such as IPv4 addresses.

CIDR consists of two groups of bits in the address. In the new age, the network prefix identifies the whole network. This is used as the basis of routing between IP networks and allocation policies.

IPv4 in-network prefix is 8-bit groups.

A typical IPv4 address is 192.168.0.5 the lowest value is 0, and the highest value is 255

In the given choices, 123.0.0.0 / 8 of the possible smallest number of hosts.

8 0
3 years ago
If you know the unit prices of two different brands of an item you are better able to
vitfil [10]

Answer:

TO UNDERSTAND TO ITS VALUES AND ITS  FEATURES

Explanation:

4 0
3 years ago
Is using abbreviations and symbols in social media a problem? Why or why not?
Ugo [173]
The correct answer is..A? 
5 0
3 years ago
Assume that we would like to expand the MIPS register file to 128 and keep the size of all other fields as in the original MPIS
garri49 [273]

Answer:

These changes has the ability to decrease the size of a program, it

can do so by going ahead to reduce the instances in which the register contents “spill” into other registers or memory, it also does so by allowing more complex operations to be implemented in one instruction as agianst requiring multiple instructions.

On the other hand they are likely able to increase the size of a program by requiring adding bits to the opcode and register fields, thereby increasing memory width

Explanation:

See answer

7 0
3 years ago
Read 2 more answers
Other questions:
  • Your license can be canceled if you __________
    14·2 answers
  • Application software definition word excel powerpoint microsoft
    13·1 answer
  • You work for a company that builds custom PCs for select clients. You are training a new employee to evaluate and select appropr
    13·1 answer
  • PAGE<br>DATE<br>0 What types of information should be there internet?​
    5·1 answer
  • What are the services offered by web-based email?​
    12·1 answer
  • Hiiiiiiiiiiiiiiiiii <br>i'm new here!!!​
    14·2 answers
  • In which of the following stages of the development process is a team MOST likely to interview a potential user of an app?
    6·1 answer
  • Write a program that asks the user for the name of a text file. The program should display the first 10 lines of the file on the
    6·1 answer
  • What's the difference between a robot and a machine?
    7·1 answer
  • In order to see what the services status will be in a given runlevel, you would use what command?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!