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
Georgia [21]
3 years ago
14

Create an application named Percentages whose main() method holds two double variables. Assign values to the variables. Pass bot

h variables to a method named computePercent() that displays the two values and the value of the first number as a percentage of the second one. For example, if the numbers are 2.0 and 5.0, the method should display a statement similar to "2.0 is 40 percent of 5.0." Then call the method a second time, passing the values in reverse order.
Computers and Technology
1 answer:
lbvjy [14]3 years ago
8 0

Answer:

The codes below implement the problem statements

Explanation:

public class Percentages {

public static void computePercent (int a,int b)

{

System.out.println(a+" is "+(a*100/b)+"% of "+b);    

}

 

public static void main(String []args)

{

int a=2;

int b=5;

computePercent(a,b);

computePercent(b,a);

}

}

<u> </u>

<u>Part(b) </u>

import java.util.*;

public class Percentages {

public static void computePercent (int a,int b)

{

System.out.println(a+" is "+(a*100/b)+"% of "+b);

}

 

public static void main(String []args)

{

Scanner s= new Scanner(System.in);

int a=s.nextInt();

int b=s.nextInt();

computePercent(a,b);

computePercent(b,a);

}

}

You might be interested in
In a pinhole camera, the image seen in the camera will be inverted<br><br> true<br> false
Sati [7]
Hey there,

Based on my research, I believe that your correct answer may be "True".<span>the image seen in the camera will be inverted because it is a pinhole camera.

~Jurgen</span>
6 0
3 years ago
Read 2 more answers
After you save a table, the new table name appears ____.
kobusy [5.1K]
Table1/2.....hope it helps
5 0
3 years ago
Read 2 more answers
What is company NDR?​
lina2011 [118]

Answer:

Explanation:

NDR is a multinational American based company with international branches in Thailand, Cambodia, and Myanmar in the telecom industry and media with sales of over US$100 Million. The company develops application store (APP Store) and application (APP) for mobile devices with 700,000+ apps in the app store.

7 0
3 years ago
Create a method called fixArray(int[][] array, int row, int col, int value) that sets the [row][column] to the correct value. Th
PolarNik [594]

Answer:

  1. public class Main {
  2.    public static void main (String [] args) {
  3.        int[][] myArray = {{1,5,6}, {7, 9, 2}};
  4.        fixArray(myArray, 1, 2, 12);
  5.        System.out.println(myArray[1][2]);
  6.    }
  7.    private static void fixArray(int[][] array, int row, int col, int value){
  8.        array[row][col] = value;
  9.    }
  10. }

Explanation:

The solution code is written in Java.

Firstly, create the method fixArray with that takes four inputs, array, row, col and value (Line 11). Within the method body, use row and col as index to address a particular element from array and set the input value to it (Line 12).

Next, we test the method in the main program using a sample array (Line 4) and we try to change the row-1 and col-2 element from 2 to 12 (Line 5).

The print statement in Line 7 will display 12 in console.

7 0
4 years ago
g Write a program that allows a user to input any text in your program. Using the tools that we have discussed, your program sho
Paladinen [302]

Answer:

Explanation:

The following function/program is written in Java. It asks the user for a sentence as an input and then splits that sentence into an array of words. Then it creates an arrayList for all of the unique words, comparing each word in the sentence with all of those in the ArrayList. If a word is found in the ArrayList it cancels the loop and moves on the next word in the sentence. Finally, it counts all of the unique words in the ArrayList and prints that total to the screen.

public static void uniqueWords() {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter a sentence:");

       String sentence = in.nextLine();

       String words[] = sentence.split(" ");

       ArrayList<String> uniqueWords = new ArrayList<>();

       for (int x = 0; x < words.length; x++) {

           boolean exists = false;

           for (int i = 0; i < uniqueWords.size(); i++) {

               if (words[x].equals(uniqueWords.get(i))) {

                   exists = true;

                   break;

               }

           }

           if (exists == false) {

               uniqueWords.add(words[x]);

           }

       }

       System.out.println(uniqueWords.size());

   }

5 0
3 years ago
Other questions:
  • You can advance slides during a slideshow by pressing the page down key
    7·1 answer
  • What are two great ways to find clues to locate commands on the ribbon?
    13·1 answer
  • Signs that a listener is paying attention include:
    10·2 answers
  • The chain of command is an unbroken line of authority that extends from the top of the organization to the lowest echelon and cl
    7·1 answer
  • Which statement about UML class diagrams is true?
    8·1 answer
  • 1) Discuss when it is best to use indexes. ​
    6·1 answer
  • To display data in a certain manner, like alphabetical order, is called
    5·2 answers
  • If number is 20, what is printed to the console after this code is executed?
    13·1 answer
  • Write a basic notation for
    8·1 answer
  • Your design company needs to create a sample animation for a client very quickly. You already have the basic graphics, and the c
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!