answer.
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
bixtya [17]
1 year ago
15

7. Test Average and Grade Write a program that asks the user to enter five test scores. The program should display a letter grad

e for each score and the average test score. Write the following methods in the program: calcAverage: This method should accept five test scores as arguments and return the average of the scores. determineGrade: This method should accept a test score as an argument and return a letter grade for the score, based on the following grading scale: Score Letter Grade 90-100 A 80-89 B 70-79 C 60-69 D Below 60 F
Computers and Technology
1 answer:
Alenkasestr [34]1 year ago
5 0

Answer:

The code solution is written in Java.

  1. import java.util.Scanner;
  2. public class TestScore {
  3.    public static void main(String[] args) {
  4.        Scanner input = new Scanner(System.in);
  5.        System.out.print("Please enter first score: ");
  6.        double firstScore = input.nextDouble();
  7.        System.out.println("Grade: " + determineGrade(firstScore));
  8.        System.out.print("Please enter second score: ");
  9.        double secondScore = input.nextDouble();
  10.        System.out.println("Grade: " + determineGrade(secondScore));
  11.        System.out.print("Please enter third score: ");
  12.        double thirdScore = input.nextDouble();
  13.        System.out.println("Grade: " + determineGrade(thirdScore));
  14.        System.out.print("Please enter fourth score: ");
  15.        double fourthScore = input.nextDouble();
  16.        System.out.println("Grade: " + determineGrade(fourthScore));
  17.        System.out.print("Please enter fifth score: ");
  18.        double fifthScore = input.nextDouble();
  19.        System.out.println("Grade: " + determineGrade(fifthScore));
  20.        System.out.println("Average score: " + calcAverage(firstScore, secondScore, thirdScore, fourthScore, fifthScore));
  21.    }
  22.    public static double calcAverage(double score1, double score2, double score3, double score4, double score5){
  23.        double average = (score1 + score2 + score3 + score4 + score5) / 5;
  24.        return average;
  25.    }
  26.    public static String determineGrade(double score){
  27.        if(score >= 90){
  28.            return "A";
  29.        }
  30.        else if(score >= 80 ){
  31.            return "B";
  32.        }
  33.        else if(score >=70){
  34.            return "C";
  35.        }
  36.        else if(score >=60){
  37.            return "D";
  38.        }
  39.        else{
  40.            return "F";
  41.        }
  42.    }
  43. }

Explanation:

Firstly, create the method, <em>calcAverage()</em>, that takes five test scores. Within the method, calculate the average and return it as output. (Line 33 - 36)

Next, create another method, <em>determineGrade()</em>, which takes only one score and return the grade based on the range of the  score. (Line 38 -54)

Once the two required methods are created, we are ready to prompt use for input five test scores using Java Scanner class. To use get user input, create a Scanner object (Line 7). Next, use getDouble() method to get an input score and assign it to variables firstScore, secondScore, thirdScore, fourthScore & fifthScore, respectively. Once a score input by user, call determineGrade() method by passing the input score as argument and immediately print out the return grade. (Line  9 - 27)

At last, call calcAverage() method by passing the first test score variables as argument and print out the returned average value. (Line 29).

You might be interested in
Problem statement: Using loop, write a program that will ask the user to enter a character for left or right. Then, the user wil
zvonat [6]
Define variables
left is l
right is r

Ask input
left or right

Ask input value

Equate l or r to the input value

Show ladder with steps equal to input value and in the side of input variable
7 0
1 year ago
1.Which of the following class definitions defines a legal abstract class?a. class A { abstract void unfinished() { } }b. class
xxMikexx [17]

Answer:(c) abstract class A { abstract void unfinished(); }

Explanation:

A legal abstract class must have the keyword abstract before the class and an abstract class has abstract functions with the keyword abstract written and a void as the return type.

8 0
2 years ago
Which statement below correctly differentiates between frames and bits? Frames have more information in them than bits. Frames a
9966 [12]
<span>Frames have more information in them than bits.
</span>
<span>Frames are made up of bits but not vice versa.


A bit (BInary digiT) is the basic unit of digital. It can be 0 (logical false, off) or 1 (not logical false - true, on). Four bits are in a nybble, which can have a value of 0 - 15, eight bits are in a byte which can have a value of 0 - 255. Words vary in size, they consist of multiple bytes and are generally correlated with the system's data bus/processor data width (a 64 bit system has an 8 byte word).
</span>
5 0
2 years ago
Read 2 more answers
Select the correct answer. Richard owns a chain of hardware stores. He wants to update the store website and write a numbered li
olga_2 [115]
What’s the answer choices ?
3 0
2 years ago
In this project, you’ll create a security infrastructure design document for a fictional organization. The security services and
gogolik [260]

Answer and explanation:

Authentication:

authentication can be done by using the user id and password, by using social sign in  or by using the biometrics. Authentication means verify the user who they claim they are and to grant them access.  

Authentication works as follows:  

Prompting the user to enter the credentials.  

Send the credentials to the authentication server.  

Match the credentials.  

Authorize the user and grants the acces

External Website security:  

External Website security is important to protect the website from hackers, electronic thieves and to prevent security breach.  

Use of firewall.  

Implement the access control.  

Use of MVC (Model View Controller) to create different view for different type of user.  

Use of encryption.  

Use of SSL certificate.

Use of security plugins.  

Implement tools and techniques for backup and disaster recovery.  

Use of network monitoring team.  

Internal Website security:  

Use of authentication to identify the user identity.  

Use of authorization to provide different user with the specific privileges and access.  

Encrypt or hide sensitive web pages.  

By implementing IT policies.  

Educate the user about the website.  

Remote Access Solution:  

Remote access provides better security, cost efficiency, ease of management, and increased availability.  

Remote access can be deployed by using the RAS gateway (single tenant or multi-tenant):

VPN(Virtual private network), BGP(Border gateway protocol), hyper-V network can be used to provide the remote access.  

Remote access can be provided by simple configuration. Remote access involves enabling user, managing their access, protecting the assets, use of remote desktop protocol and managing server sessions, remoteApp and personal and pooled desktop.  

Firewall and Basic rules recommendations:  

Firewall is important for managing the traffic and providing external website security.  

Rules to prevent SQL injection and XSS.  

Allow only the specific type of traffic.  

Use access rules for IP security.  

Implement certain IT policies.  

Can implement their own rule.  

Wireless Security:  

Nowadays Wifi is being used in every organization and it prevents the network from malicious and unauthorized access.  

Wireless security can be provided by the use of encryption, decryption, authentication and authorization.  

VLAN configuration:  

VLAN are important for traffic filtering and providing the logical division of the network.  

VLAN can be configured for web interface and can provide web filtering.  

In the following manner VLAN can be configured for web interface:  

Switching => VLAN => Advanced => VLAN Membership  

Switching => VLAN > Advanced => Port PVID Configuration.  

VLAN web filtering:  

VLAN can be configured between router and firewall, router and gateway, router and switch and by doing so one can filter the web traffic that passes the network.  

Laptop Security Configuration:  

Use of password, VPN and registering the laptop by their MAC address will provide laptop security. Use of security tool for local machine is also a good option. Use of device level authentication by using local username and password is also a good idea.  

Application policy recommendations:  

Application policy includes use of cookies, social media integration, access control, generating notifications and implanting other organization and IT rules.  

Security and privacy policy recommendations:  

It includes the list of security methods to be implemented for traffic filtering, IP spoofing, user authentication and other specific policy for the website.  

Intrusion detection or prevention for systems containing customer data:  

IPS is implemented behind the firewall and it matches the incoming traffic against the security policies. It matches the signature and handles the intrusion if any and generates the log and alerts for the same.  

IDS goal is to identify malicious traffic before it can proceed further into the network. It generates alerts and notification so that the network monitoring team can look after the intrusion.  

Use of anomaly based detection and prevention system is the better choice.

6 0
1 year ago
Other questions:
  • Lucas put a lot of thought into the design for his company's new white paper. He made sure to include repeating design elements
    13·2 answers
  • Which item is essential to know before sketching a navigation menu flowchart? template specifics, such as horizontal or vertical
    12·1 answer
  • Select the examples that best demonstrate likely employers for Journalism and Broadcasting workers. Check all that apply.
    11·2 answers
  • Write a class for a Cat that is a subclass of Pet. In addition to a name and owner, a cat will have a breed and will say "meow"
    9·1 answer
  • Within a word processing program, predesigned files that have layout and some page elements already completed are called text bo
    15·1 answer
  • Design an application for Bob's E-Z Loans. The application accepts a client's loan amount and monthly payment amount. Output the
    8·1 answer
  • A _______ bulb contains a high-pressure gas. Oils from the hands can affect the expansion of the glass, which can shorten the li
    13·1 answer
  • Describe a strategy for avoiding nested conditionals. Give your own example of a nested conditional that can be modified to beco
    15·1 answer
  • Justify the statement "The same job title can have different job roles and different qualification criteria in different organiz
    7·1 answer
  • A school has 100 lockers and 100 students. All lockers are closed on the first day of school. As the students enter, the first s
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!