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
mylen [45]
3 years ago
12

Create a program that contains 4 methods / functions... main(), getTestScores(), calcAverage(), and displayAverage(). The main()

method should call the getTestScores() method to get and return each of 3 test scores. The main function should then call the calcAverage() method and send the three scores down to calculate and return the average of the three test scores. The main() method should then call the displayAverage() method to display the average of test scores.
Computers and Technology
1 answer:
jeyben [28]3 years ago
8 0

Answer:

import java.util.Scanner;

public class  num6{

   static int getTestScores(){

       System.out.println("Enter the Score");

       Scanner in = new Scanner(System.in);

       int score = in.nextInt();

       return score;

   }

   static double calcAverage(int score1, int score2, int score3){

       return (score1+score2+score3)/3;

   }

   static void displayAverage(double ave){

       System.out.println("The Average is "+ave);

   }

   public static void main(String[] args) {

       int num1 = getTestScores();

       int num2 = getTestScores();

       int num3 = getTestScores();

       //Calling Calculate Average

       double average = calcAverage(num1,num2,num3);

       //Calling displayAverage

       displayAverage(average);

   }

}

Explanation:

  • Using Java programming Language
  • Create the four methods
  • getTestScores() Uses the Scanner Class to receive an in variable and return it
  • calcAverage() accepts three ints as parameter calculates their average and return it
  • displayAverage() Accepts a double and prints it out with a concatenated string as message
  • In the Main Method, getTestScores is called three times to obtain three numbers from the user
  • calAverage is called and handed the three numbers
  • printAverage is called to output the calculated average
You might be interested in
Example of analog computer and digital computer ​
Nataliya [291]
Give some famous examples of analog computers. Ans. Some examples are operational amplifiers, mechanical integrators, slide rules, tide predictors, electric integrators, etc. These are in use to solve the problems related to partial differential equations, electronic machines, and also neural networks.(Analog). Examples of a digital electronic computers include the IBM PC, the Apple Macintosh as well as modern smartphones. ... An example of a parallel computation system using the abacus would be a group of human computers using a number of abacus machines for computation and communicating using natural language.(Digital)
4 0
3 years ago
Create a directory called projects directly inside /home/fparker. Change the owner of /home/fparker/projects to the fparker user
AlekseyPX
Cd /home/fparker
mkdir projects
chown /home/fparker/projects fparker:fparker
adduser ljenkins (set password to password123 in menu)

Use either “fdisk” or “parted” to format the disk, I can’t completely answer that part of the question without knowing the hierarchy of the file system)
4 0
2 years ago
https://.Mia is taught to go to sleep when the light is turned off. However, for many months Mia no longer falls asleep when the
kotykmax [81]

Answer:

Spontaneous recovery is the correct answer.

Explanation:

7 0
4 years ago
Write a program to determine the addresses of memory locations allocated to various variables as follow:
Andreas93 [3]

Here you go,

PROGRAM


#include<stdio.h>

#include<stdlib.h>

int main()

{

   short int a,b;

   int c,d;

   long int e,f;

   short int size_short,size_int,size_long_int;

//printing address of variable using void pointer

   printf("\nAddress of first short int variable : %p", (void*)&a);

   printf("\nAddress of second short int variable : %p", (void*)&b);

   printf("\n\nAddress of first int variable : %p", (void*)&c);

   printf("\nAddress of second int variable : %p", (void*)&d);

   printf("\n\nAddress of first long int variable : %p", (void*)&e);

   printf("\nAddress of second long int variable : %p", (void*)&f);

   //calculating size by subtracting memory address

   size_short = (short int)((void*)&a - (void*)&b);

   size_int = (short int)((void*)&c - (void*)&d);

   size_long_int = (short int)((void*)&e - (void*)&f);

   printf("\n\nsize of short variable by subtracting address : %u", size_short);

   printf("\n size of short variable by using sizeof() : %u", sizeof(a));

   printf("\n\nsize of int variable by subtracting address : %u", size_int);

   printf("\n size of int variable by using sizeof() : %u", sizeof(c));

   printf("\n\nsize of long int variable by subtracting address : %u", size_long_int);

   printf("\n size of long variable by using sizeof() : %u", sizeof(e));

   return 0;

}

5 0
4 years ago
Identify possible advantages and disadvantages of using automatic withdrawal to pay bills
Aleonysh [2.5K]

advantages. discounts, builds credit, helps keep track on when you need to pay.

disadvantages. could overcharge if it doesn't have enough, could ruin credit, could jeopardize future loans

5 0
3 years ago
Read 2 more answers
Other questions:
  • Steven is in a meeting and he is sharing a graph on his monitor with fifty other people. So that the others do not need to crowd
    9·1 answer
  • How to make the heart symbol in photoshop
    13·2 answers
  • X=10 ;
    14·1 answer
  • The tax calculator program of the case study outputs a floating-point number that might show more than two digits of precision.
    7·1 answer
  • AW Computing uses a private sharing model for cases. A select group of five users need read/write access to all cases with a spe
    8·1 answer
  • When users talk about font size,
    10·2 answers
  • We write programs as a sequence of operation. they flow through the computer as?
    11·1 answer
  • Do you humans know what math is?
    9·1 answer
  • 1. In the Entity-Relationship Model, relationships can have attributes.
    11·1 answer
  • 3<br> Select the correct answer.<br> What is the output of the following HTML code?<br>Please
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!