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
Add (total) all the number in the list (below) using a for loop, but skip over the number at index 3.
user100 [1]

Answer:

The program in Python is as follows:

numbers = [10,20,30,40,50,60,100]

total = 0

for i in range(len(numbers)):

   if i != 3:

       total+=numbers[i]

print(total)

Explanation:

This initializes the list

numbers = [10,20,30,40,50,60,100]

Set total to 0

total = 0

This iterates through numbers

for i in range(len(numbers)):

This ensures that the index 3, are not added

<em>    if i != 3:</em>

<em>        total+=numbers[i]</em>

Print the calculated sum

print(total)

3 0
2 years ago
Step 1: Configure the initial settings on R1. Note: If you have difficulty remembering the commands, refer to the content for th
Andru [333]

Answer:

The configuration of the R1 is as follows

Explanation:

Router>enable

Router#show running-config

Router#show startup-config

Router#configure terminal

Router(config)#hostname R1

R1(config)#line console 0

R1(config-line)#password letmein

R1(config-line)#login

R1(config-line)#exit

R1(config)#enable password cisco

R1(config)#enable secret itsasecret

R1(config)#service password-encryption

R1(config)#banner motd #Unauthorized access is strictly prohibited#

R1(config)#end

R1#exit

R1>enable

R1#copy running-config startup-config

R1#show flash

R1#copy startup-config flash

3 0
2 years ago
Viết chương trình hoàn chỉnh các yêu cầu sau:
Blababa [14]

Explanation:

the perimeter of an aluminium sheet is 120 CM if its length is reduced by 10% and its breadth is increased by 20% the perimeter does not change find the measure of the length and the breadth of the sheet

4 0
3 years ago
One vital component of your professional behavior with regard to computing systems today is the creation of​ _________.
zlopas [31]
<span>One vital component of your professional behavior with regard to computing systems today is the creation of​ strong passwords.
It is very important to have a good password on your computer, especially if you are dealing with sensitive data and information. It would be for the best to create such a password which won't be hacked into easily, in case somebody wants to steal your data.
</span>
3 0
2 years ago
Suppose there are 10 computers on a network that are configured to share a few printers and a single document folder. The compan
ivanzaharov [21]

Answer:

B- Workgroup model

Explanation:

A workgroup model can be defined as a process which enables system to be peer together in order to access the resources shared like files and printers at the same time.

In work group microsoft operating systems tend to share files, printers, and even Internet connection among them which is why work group is important especially in a place in which their are various computers with limited files and printer or internet connection.

4 0
3 years ago
Other questions:
  • What is the difference between a learner’s license and an operator’s license?
    5·1 answer
  • Why is it so important that you know how much traffic dfs replication requires?
    13·2 answers
  • What kind of memory modules include registers between the system’s memory controller and the module’s memory chips, registers th
    7·2 answers
  • Write the definition of a function named quadratic that receives three double parameters a, b, c. If the value of a is 0 then th
    12·1 answer
  • What is the difference between "What I ought to do?" and "What kind of person should I be"?
    12·1 answer
  • Write a method that returns a version of the given array where all the 10's have been removed. The remaining elements should shi
    9·1 answer
  • The working window of a presentation is the O outline O handout 0 notes o slide​
    5·2 answers
  • You designed a program to create a username using the first three letters from the first name and the first four letters of the
    6·1 answer
  • Any looping construct can be nested inside another loop is known as
    11·1 answer
  • Which of the following statements describes the general idea of an assistive media​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!