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
Choose the word that best completes this sentence. ________ can only grow and multiply within the cells of another living thing,
melomori [17]
The correct answer that would best complete the given statement above would be the word VIRUSES. Here is the complete statement. Viruses can only grow and multiply within the cells of another living thing, but they can remain active on a surface for several hours or days.
4 0
2 years ago
Everfi module 7 answers
Nat2105 [25]
What is the question?
7 0
2 years ago
Read the following scenario, and then answer the question below.
shtirl [24]
Establish what skills are required to reach his goal
8 0
2 years ago
Read 2 more answers
What's the difference between kilobyte and kibibyte, and why was the IEC convention for computer international memories made???
Masja [62]

Answer:

The Kibibyte was developed to take place of the kilobytes in the computer science context where the Kilobyte stands for 1024 bytes. And the Kilobyte interpretation to mean 1024 bytes, conflicts the Standard definition of the prefix kilo or 1000. And the IEC convention for computer international memories was made to define the international standards for electrical, electronic and related technologies.

Explanation:

Please check the answer section.

8 0
3 years ago
Rick is pursuing an undergraduate degree in electronics engineering. He aspires to be a robotics software engineer. Which topic
weeeeeb [17]

Options:

A.  database programming

B.  Embedded C

C.  testing software

D.  ABET

Answer:

<u>B.  Embedded C</u>

Explanation:

<em>Remember,</em> many robotic systems  make use of embedded systems, and one important programming language used is the C (Embedded C) Programming language.

Hence, since many hardware components can be programmed using C, it would therefore be necessary for Rick to be aware of Embedded C.

4 0
2 years ago
Other questions:
  • Hi, I have several computer questions. These refer to the history of the internet. I would like to know if everything we look fo
    12·1 answer
  • Which mistakes are NOT highlighted by the spell checker in a word-processing document?
    15·2 answers
  • Customer Premises Equipment (CPE) includes all devices connected to the PSTN, where the ownership and the responsibility for mai
    15·1 answer
  • What laptops can you get for 2500$ and should mostly using Microsoft applications.
    14·2 answers
  • Which of the following is true? Group of answer choices worst case time of Heapsort is better than worst cast time of Quicksort
    10·1 answer
  • Why did Simon bring Michael home?​
    9·2 answers
  • A company has a hybrid ASP.NET Web API application that is based on a software as a service (SaaS) offering.Users report general
    9·1 answer
  • In which situation would saving a Word document as a PDF be most useful?
    9·2 answers
  • Several disaster relief nonprofits want to create a centralized application and repository of information so that they can effic
    7·1 answer
  • Computer science - algorithms - flowcharts
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!