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
Dominik [7]
3 years ago
10

Write a second convertToInches() with two double parameters, numFeet and numInches, that returns the total number of inches. Ex:

convertToInches(4.0, 6.0) returns 54.0 (from 4.0 * 12 + 6.0).FOR JAVA PLEASEimport java.util.Scanner;public class FunctionOverloadToInches {public static double convertToInches(double numFeet) {return numFeet * 12.0;}/* Your solution goes here */public static void main (String [] args) {double totInches = 0.0;totInches = convertToInches(4.0, 6.0);System.out.println("4.0, 6.0 yields " + totInches);totInches = convertToInches(5.9);System.out.println("5.9 yields " + totInches);return;}}
Computers and Technology
1 answer:
mixer [17]3 years ago
5 0

Answer:

   public static double convertToInches(double numFeet, double numInches){

       return (numFeet*12)+numInches;

   }

Explanation:

This technique of having more than one method/function having the same name but with different parameter list is called method overloading. When the method is called, the compiler differentiates between them by the supplied parameters. The complete program is given below

public class FunctionOverloadToInches {

   public static void main(String[] args) {

       double totInches = 0.0;

       totInches = convertToInches(4.0, 6.0);

       System.out.println("4.0, 6.0 yields " + totInches);

       totInches = convertToInches(5.9);

       System.out.println("5.9 yields " + totInches);

       return;

   }

   public static double convertToInches(double numFeet)

       {

           return numFeet * 12.0;

       }

       /* Your solution goes here */

   public static double convertToInches(double numFeet, double numInches){

       return (numFeet*12)+numInches;

   }

}

You might be interested in
Match each code snippet to its appropriate markup language name
Mazyrski [523]

Answer:

Please find the complete solution in the attached file.

Explanation:

8 0
2 years ago
The 'client area' of a window is the area used to display the contents of the window (thus a title bar or border would lie outsi
Lady_Fox [76]

Answer:

<u>Window.java</u>

  1. public class Window {
  2.    int width;
  3.    int height;
  4.    public Window(int width, int height){
  5.        this.width = width;
  6.        this.height = height;
  7.    }
  8.    public int getWidth(){
  9.        return width;
  10.    }
  11.    public int getHeight(){
  12.        return height;
  13.    }
  14.    public int getClientAreaHeight(){
  15.        return getHeight();
  16.    }
  17. }

<u>Main.java</u>

  1. public class Main {
  2.    public static void main (String [] args) {
  3.        Window win1 = new Window(12, 15);
  4.        System.out.println(win1.getClientAreaHeight());
  5.    }
  6. }

Explanation:

<u>Window.java</u>

There is a Window class with two int type attributes, width and height (Line 1 - 3).

The constructor of this class will take two inputs, width and height and set these input to its attributes (Line 5 - 8). There are two methods getWidth and getHeight which will return the value of attributes width and height, respectively (Line 10 - 16).

The required new method getClientAreaHeight is defined in line 18 -20. This method will call the getHeight method to return the height value of the window (Line 19).

<u>Main.java</u>

We test the Window class by creating one Window instance and call the getClientAreaHeight method and print the return output (Line 1 -6).

We shall see 15 is printed.

4 0
3 years ago
Why is wider channel bandwidth good?
Nookie1986 [14]

Answer:

The wider channel bandwidth is efficient and good as it help in increasing the speed of the transmission. Due to the wider channel of the bandwidth it also lead to consuming less energy of the battery and make cost effective.

Due to the wider bandwidth, the number of clients can easily share and transfer the data in the channel and also make the transmission complete.

If the channel of the bandwidth is double then, the single transmission can easily carry more data. Hence, it also lead to double the speed of the transmission.

7 0
3 years ago
Write a structure declaration to hold the following data about a savings account: Account Number (string object) Account Balance
Citrus2011 [14]

Answer:

Explanation:

The following is written in C and creates a structure declaration named savingsAccount and adds all of the values into it as defined in the question.

struct savingsAccount {

char AccountNumber[] = "";

double AccountBalance;

double InterestRate;

double AverageMonthlyBalance;

}

4 0
3 years ago
Modern ancestor of the typewriter
Rashid [163]
I would think Microsoft Word would be the answer. It does everything a typewriter can.
4 0
2 years ago
Read 2 more answers
Other questions:
  • While trying to solve a network issue, a technician made multiple changes to the current router configuration file. The changes
    7·1 answer
  • Write a function that takes an array of integers and its size as parameters and prints the two largest values in the array. In t
    5·1 answer
  • Hilary works at Klothes Kloset. She quickly helps the customers, and her cash drawer is always correct at the end of her shift.
    9·1 answer
  • Pamela finds that she is constantly spelling the word “color” as “colour” when she is typing. Even though this is how the word i
    11·1 answer
  • What is included on the HP PC Hardware Diagnostics 3-in-1 USB Key that allows you to recover systems that cannot boot?
    14·1 answer
  • Who is a data base administrator
    12·1 answer
  • Write a method so that the main() code below can be replaced by simpler code that calls method calcMilesTraveled(). Original mai
    11·1 answer
  • The small flash memory used in<br>protable device like Laptop<br><br>​
    10·1 answer
  • How many times do you return after the dateline ?
    12·1 answer
  • If a TextView has not been displayed yet, it is possible to retrieve measurements about its width and height using the _________
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!