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
stiv31 [10]
4 years ago
5

Create a program that used a main method and a method named "subtractTwoNumbers()". Your subtractTwoNumbers() method should requ

ire three integers to be sent from the main method. The second and third numbers should be subtracted from the first number.
Computers and Technology
1 answer:
Reptile [31]4 years ago
6 0

Answer:

import java.util.Scanner;

public class num4 {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("First number:");

       int fnum = in.nextInt();

       System.out.println("Second number:");

       int snum = in.nextInt();

       System.out.println("Third number:");

       int tnum = in.nextInt();

       //Call method subtractTwoNumbers

       System.out.println("Subtracting the second and third num from the first yeilds" +

               " "+subtractTwoNumbers(fnum,snum,tnum));

   }

   public static int subtractTwoNumbers(int fnum, int snum, int tnum){

       int sub = fnum-(snum+tnum);

       return sub;

   }

}

Explanation:

  • Java is used to solve this problem
  • Use Scanner class to receive three values and stored them in variables as fnum, snum and tnum for first number, second number and third number respectively
  • Create the method subtractTwoNumbers() that subtracts the sum of snum and tnum from fnum and returns the value
  • In the main method call subtractTwoNumbers() and pass the three numbers as arguments
You might be interested in
Create a Python program that asks the user in which direction to go? north, South East, or West?
QveST [7]

Answer:

huh

Explanation:

adsfghjkhgfdghjfghjkl

7 0
3 years ago
Why are the keys on the qwerty keyboard arranged the way they are?
sveticcg [70]
Sholes arranged the keys in their odd fashion to prevent jamming on mechanical typewriters by separating commonly used letter combinations.
7 0
3 years ago
"assignment is to create a program that will read a value from an array, and then place this value in another array with the loc
White raven [17]

Answer:

#include <iostream>//including libraries

using namespace std;

int main()

{

int arr[6] = { 0,1,2,3,4,5 };//make sure size of arr is 1 less than secArr

int secArr[7];//second array (1 element bigger)

for (int i = 0;i < 6;i++)//looping through each element (6 times)

{

 secArr[i + 1] = arr[i];//transferring elements to second array and shifting by 1 cell

 cout << secArr[i + 1] << endl;//printing elements of second array

}

return 0;//terminating program

}

Explanation:

The array size can range from any number. just make sure to keep arr one less than secArr. This is because we need the room for the extra element. This task is to help you understand how array work and how to parse through them using loops. For loops are the best for this task because even if you think intuitively, they work for as long as there are items in the array. and you can define the size yourself.

5 0
3 years ago
Write a program that displays a menu allowing the user to select air water, or steel. After the user has made a selection, the n
luda_lava [24]

Answer:

// Program is written in C++ Programming Language

// Comments are used for explanatory purpose

// Program starts here

#include<iostream>

using namespace std;

int main ()

{

// Declare Variable

int selection;

// Prompt user to make a selection of medium between air, water or steel.

cout<<"Make Selection"<<'\n'<<"Press 1 for Air"<<'\n'<<"Press 2 for Water"<<'\n'<<"Press 3 for Steel";

cin>>selection;

// Check for entry

if(selection == 1) {

cout<<"You selected Air"<<'\n';

cout<<"The distance travelled by sound wave in air is 1,125 feet in 1 second";

}

else if(selection == 2) {

cout<<"You selected Water"<<'\n';

cout<<"The distance travelled by sound wave in water is 4859 feet in 1 second";

}

else if(selection == 3) {

cout<<"You selected Steel"<<'\n';

cout<<"The distance travelled by sound wave in steel is 19554 feet in 1 second";

}

else

cout<<"Invalid Selection";

return 0;

}

7 0
4 years ago
Knowledge of html and css is considered essential for the job of a(n _______.
7nadin3 [17]
<span>Knowledge of html and css is considered essential for the job of a web-designer. Html and css are useful if you want to build an informational web-site or landing page. Html is used for page structure and basic style. Css used for advanced styles, it helps you to make your web-site look prettier. If you want to make the advanced functions on your web-site, you should use javascript or php.</span>
4 0
3 years ago
Other questions:
  • Whats the difference between search engine and web browser?
    6·2 answers
  • The position of a _____ is a nontechnical position responsible for defining and implementing consistent principles for setting d
    15·1 answer
  • PowerPoint allows you to input files from variety of sources, such as Microsoft access.
    6·1 answer
  • Pleaseeee help me w this!
    10·1 answer
  • Devon would like to install a new hard drive on his computer. Because he does not have a SATA port available on his motherboard,
    7·1 answer
  • What will be the results of the following code? final int Array_Size = 5;An error will occur when the program runs. There will b
    10·1 answer
  • Most C++ catastrophe vulnerabilities rely on uninitialized function pointers in a class.
    13·1 answer
  • Write the Q basic program to find the area of room.​
    10·1 answer
  • What is it called when servers on the Internet supply applications as a service, rather than a product
    14·1 answer
  • Please help with this coding question
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!