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
lidiya [134]
3 years ago
13

In the main function, define five variables of type int, named: first, second, third, fourth, and total. Also in the main functi

on, define three variables of type double named: decimalOne, decimalTwo and decimalTotal Write one function named getData which asks the user for the data and puts it in first, second, third, fourth, decimalOne, and decimalTwo. (You may copy your getData from problem H1 and make additions to manage fourth, decimalOne, and decimalTwo.) Write a function named computeTotal which can take two, or three int arguments and returns an int. Write another function, also named computeTotal which takes four int arguments and returns an int. Write another function, also named computeTotal which takes two double arguments and returns a double. Write a function named printAll which takes three arguments of type int. Write a function named printAll which takes four arguments of type int. Write a function named printAll which takes five arguments of type int. Write a function named printAll which takes three arguments of type double.
Computers and Technology
1 answer:
fiasKO [112]3 years ago
8 0

Answer:

  1. import java.util.Scanner;
  2. public class num8 {
  3.    public static void main(String[] args) {
  4.    int first, second, third, fourth,total;
  5.    double decimalOne, decimalTwo, decimalTotal;
  6.    }
  7.    public static void getData(int first, int second, int third, int fourth, double decimalOne, double decimalTwo){
  8.        System.out.println("Enter the Values");
  9.        Scanner in = new Scanner(System.in);
  10.        first=in.nextInt();
  11.        second=in.nextInt();
  12.        third=in.nextInt();
  13.        fourth=in.nextInt();
  14.        decimalOne = in.nextDouble();
  15.        decimalTwo = in.nextDouble();
  16.    }
  17.    public static int computeTotal(int first, int second, int third){
  18.        return first+second+third;
  19.    }
  20.    public static int computeTotal(int first, int second, int third, int fourth){
  21.        return first+second+third+fourth;
  22.    }
  23.   public static double computeTotal(double decimalOne, double decimalTwo){
  24.        return decimalOne+decimalTwo;
  25.    }
  26.    public static void printAll( int first, int second, int third){
  27.        System.out.println("Number one, two and three are: "+first+" "+second+" "+third);
  28.    }
  29.    public static void printAll( int first, int second, int third, int fourth){
  30.        System.out.println("Number one, two and three and four are: "+first+" "+second+
  31.                " "+third+" "+fourth);
  32.    }
  33.   public static void printAll( int first, int second, int third, int fourth, int fifth){
  34.        System.out.println("Number one, two and three and four are: "+first+" "+second+
  35.                " "+third+" "+fourth+" "+fifth);
  36.    }
  37.    public static void printAll( double first, double second, double third){
  38.        System.out.println("Number one, two and three and four are: "+first+" "+second+
  39.                " "+third);
  40.    }
  41. }

Explanation:

This solution is provided in Java:

All the variable declarations are done in the main method (lines 3-6)

Eight methods as specified in the question are created (Lines 7, 17, 20, 23, 26, 29, 33 and 37).

Observe the concept of Method Overloading (i.e. methods with same name and return types but different parameter list)

You might be interested in
How many possible keys does the playfair cipher have? an approximate power of 2
Lorico [155]
I don't know but I am guessing 666 or 777 or 888.
7 0
2 years ago
What is the output of the following code?
Lynna [10]

Answer:

The output is 24

Explanation:

Given

The above code segment

Required

The output

We have (on the first line):

x = 6

y = 3

z=24

result=0

On the second line:

result = 2*((z/(x-y))\%y+10)

Substitute the value of each variable

result = 2*((24/(6-3))\%3+10)

Solve the inner brackets

result = 2*((24/3)\%3+10)

result = 2*(8\%3+10)

8%3 implies that, the remainder when 8 is divided by 3.

The remainder is 2

So:

result = 2*(2+10)

result = 2*12

result = 24

<em>Hence, the output is 24</em>

8 0
2 years ago
Which solution eliminates the need for dedicated high-speed WAN connections between sites
s344n2d4d5 [400]

Answer:

running in the 90 s intensifies

Explanation:

4 0
2 years ago
Why would you convert your birth year to binary numbers?
I am Lyosha [343]

Answer:

Write out your birthday in the following format: M/DD/YY. For example, if your birthday is on June 11, 2013, it would be written as 6/11/13.

2. Convert the birthday date to binary format. Using our same example from above, 6/11/13 translated into binary code would be: 110/1011/1101.

3. Select one color of bead to represent “0”, a second color to represent “1” and then the third color to represent a space (/) between the numbers.

4. Layout the beads to represent your birthdate in binary code. Don’t forget the third color for the spaces in between the numbers!

5. Once laid out, string all the beads on to the string or pipe cleaner.

6. Tie a knot around the ends and enjoy your one-of-a kind masterpiece as a piece of jewelry or a bag tag….the options are endless!

6 0
3 years ago
Which trait depicts honesty?
Aliun [14]

(B) reporting additional cash found in the cash register

5 0
3 years ago
Other questions:
  • Why should you delete files from your computer? (multiple answers can be chosen)
    5·2 answers
  • What runs horizontally and is identified with numbers?
    12·2 answers
  • Help pleaseeeeeeeeeeeee
    13·2 answers
  • g A sign of thrashing is Group of answer choices the CPU utilization increases as the degree of multiprogramming is increased. t
    5·1 answer
  • What do I do if my friend wants me to watch a video at my house?
    8·2 answers
  • What is the web page path on the web server for the URL:
    12·1 answer
  • 1) Identify at least four examples and uses of application software.​
    5·2 answers
  • Need answer Asap!!!! Which file type is the best choice if the image will be made into a billboard?
    12·1 answer
  • Describe how a computer checks whether the image just taken by the camera matches the scanned photograph.
    12·1 answer
  • Is it true that if the user log out the computer will turn off automatically​
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!