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
From the binary search algorithm, it follows that every iteration of the while loop cuts the size of the search list by half.
Colt1911 [192]

Answer:

True: In binary search algorithm, we follow the below steps sequentially:

Input: A sorted array  B[1,2,...n] of n items and one item x to be searched.

Output: The index of x in B if exists in B, 0 otherwise.

  1. low=1
  2. high=n
  3. while( low < high )
  4.  {      mid=low + (high-low)/2
  5.         if( B[mid]==x)
  6.          {
  7.             return(mid)  //returns mid as the index of x
  8.           }
  9.          else
  10.          {
  11.              if( B[mid] < x)      //takes only right half of the array
  12.               {
  13.                 low=mid+1
  14.               }
  15.              else               // takes only the left half of the array
  16.               {
  17.                high=mid-1
  18.               }
  19.           }
  20.  }
  21. return( 0 )

Explanation:

For each iteration the line number 11 or line number 15 will be executed.

Both lines, cut the array size to half of it and takes as the input for next iteration.

6 0
3 years ago
Where is permanent data in the computer stored? Whenever Jim starts his laptop, he sees some commands and numbers appearing on h
Wittaler [7]

the operating system ithink

4 0
3 years ago
A Transmission Control Protocol (TCP) connection is established and two devices ensure that they're speaking the same protocol.
son4ous [18]

Answer:

The answer is "Three-way handshake".

Explanation:

In this mechanism, two processes associated with communication throughout SEO techniques. In this, the sequence of data packets and recognized by the number of exchanges during the threefold handshake process.

  • This method initiating the process between two apps,  Handshaking begins whenever a computer sends the message to its system.
  • The process of the communication system has been established into the two devices,  which simply send many messages, which allow them to settle the protocol for communication.
6 0
3 years ago
Javier inherited rights to his grandfather’s writing, which was protected by copyright law that expired a few years later. What
Yanka [14]

Answer:

C. The copyright is classified differently.

Explanation:

Since it is a writing and not a business or a car brand or a computer company like that high stuff that is very important it wouldn't effect you since you are family and since he left you rights to the copyright you can re copyright it after  it is expired with enough proof that he gave you rights.

3 0
2 years ago
Ginny faced an application error while executing the recorder in opera. Which web browser is generally recommended to use with r
NemiM [27]

Internet Explorer 9+ is the web browser recommended to use with recorders.

<h3>What is a web browser?</h3>

Anywhere on the internet is reachable with a web browser. It pulls data from other websites and shows it on your smartphone or computer. The HTTP Send Standard, which outlines how text, pictures, and audio are communicated on the web, is employed to transfer the data.

As we know,

Recorders are perfect for desktop applications because they can record a variety of items, including mouse clicks, scrolling, radio buttons, list boxes, checkboxes, and drop-down menus.

Thus, Internet Explorer 9+ is the web browser recommended to use with recorders.

Learn more about the web browser here:

brainly.com/question/19459381

#SPJ4

6 0
1 year ago
Other questions:
  • What are some good job skills?
    12·1 answer
  • 4. Who developed the first design technology program which had a
    12·1 answer
  • Who has access to the source code of proprietary software
    6·1 answer
  • In the SQL environment, a _____________ is a logical group of database objects – such as tables and indexes – that are related t
    11·1 answer
  • Where is the worlds biggest cookie​
    7·2 answers
  • A _________________________ can use SOAP headers to carry meta information in its messages. A. Web service B. REST Service C. Co
    14·1 answer
  • which of the following is another term for a variable, such as cost or schedule, that limits the freedom of design, development,
    11·1 answer
  • What is the meaning of photography​
    5·2 answers
  • Explain why the computer is powerful working tool???​
    7·1 answer
  • When installing a Windows 10 an already installed Windows 7 what happen​
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!