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
iren2701 [21]
2 years ago
5

Write an application that calculates and displays the amount of money a user would have if his or her money could be invested at

5 percent interest for one year. Create a method that prompts the user for the starting value of the investment and returns it to the calling program. Call a separate method to do the calculation, and return the result to be displayed. Save the program as Interest.java.
Computers and Technology
1 answer:
S_A_V [24]2 years ago
4 0

Answer:

Following are the program to this question:

import java.util.*;//import package for user input

class Interest //defining class Interest

{

   static double rate_of_interest = 5.00;//defining static double varaibale  

   public static double Invest_value()//defining method Invest_value

   {

           double invest;//defining double variable invest

           Scanner inc = new Scanner(System.in);//creating Scanner class object  

           System.out.print("Enter investment value: ");

           invest = inc.nextDouble();//input value in invest variable

           return invest;//return invest value

  }

  public static double calculated_Amount(double invest)//defining method calculated_Amount that accept parameter

  {

           double amount;//defining double variable

           amount = invest+ (invest * (rate_of_interest/100));//use amount to calculat 5 % of invest value

           return amount;//return amount value

  }

   

   public static void main(String[] as)//defining main method

   {

   double investment_value;//defining double variable

   investment_value= Invest_value();//use investment_value to hold method Invest_value value

   System.out.println("The 5% of the invest value: "+ calculated_Amount(investment_value));//use print method to print calculated_Amount value

  }

}

Output:

Enter investment value: 3000

The 5% of the invest value: 3150.0

Explanation:

In the above program a class "Interest", is defined inside the class a static double variable "rate_of_interest"  is declared that store a double value, in the next step, two methods "Invest_value and calculated_Amount" is declared.

In the "Invest_value" method, scanner class object is created for input value in the "invest" variable and the "calculated_Amount" accepts an "invest" value in its parameter and calculate its 5% and store its value in the "amount" variable.

Inside the main method, the "investment_value" is declared that holds the "Invest_value"  method value and pass the value in the "investment_value" variable in the "calculated_Amount" method and prints its return value.

You might be interested in
In this project, you will add a (self-proclaimed) priority attribute to xv6 processes. The priority does not actually do anythin
kondor19780726 [428]

Answer:

Priority programming is a process programming method based on priority. In this technique, the developer chooses the tasks to work according to priority, which is different from other types of programming, for example, a simple round-robin.

On UNIX and many other systems, higher priority values represent lower priority processes. Some of the systems, such as Windows, use the opposite convention: a higher number means a higher priority

<h3>Explanation: </h3>

Priorities can be dynamic or static. Static priorities are assigned during creation, while dynamic priorities are assigned according to the behavior of the processes while they are in the system. To illustrate, the planner could favor intensive input / output (I / O) tasks, allowing expensive requests to be issued as soon as possible.

Priorities can be defined internally or externally. Internally defined priorities make use of a measurable amount to calculate the priority of a given process. On the contrary, external priorities are defined using criteria beyond the operating system (OS), which may include the importance of the process, the type and sum of the resources used for the use of the computer, user preferences , trade and other factors such as politics etc.

i hope this is right lol

6 0
3 years ago
Brake fluid is made up of a chemical that:
TEA [102]

A) IS MOSTLY JUST ENGINE Oil.

7 0
3 years ago
Read 2 more answers
Jake is preparing his resume. He is applying for the position of iOS application developer at a large software company. He wants
gavmur [86]

Answer:

C. Modern Programming Language Skills

Explanation:

4 0
2 years ago
What is the most significant result based on the development of windmills and water wheels?
daser333 [38]
Power both wind mills and water wheels produced power which was used for textile factories ect
6 0
3 years ago
Create a lottery game application. Generate three random numbers (see Appendix D for help in doing so), each between 0 and 9. Al
Pachacha [2.7K]

The question is not complete! Here is the complete question and its answer!

Create a lottery game application. Generate three random numbers (see Appendix D for help in doing so), each between 0 and 9. Allow the user to guess three numbers. Compare each of the user’s guesses to the three random numbers and display a message that includes the user’s guess, the randomly determined three-digit number, and the amount of money the user has won as follows:

no matches: 0

any one matching: 10$  

two matching: 1000$  

three matching: 100000$  

Code with Explanation:

#include <iostream>

using namespace std;

int main()

{

int matches=0;

int guess_1, guess_2, guess_3;

int num_1, num_2, num_3;

// get 3 digits from the user

cout<<"Enter first guess digit 0 to 9"<<endl;

cin>>guess_1;

cout<<"Enter second guess digit 0 to 9"<<endl;

cin>>guess_2;

cout<<"Enter third guess digit 0 to 9"<<endl;

cin>>guess_3;

// every time program runs srand() generates new random numbers and rand()%10 makes sure that number is single digit 0 to 9

srand(time(NULL));

num_1=rand()%10;

cout<<"First lottery digit: "<<num_1<<endl;

num_2=rand()%10;

cout<<"Second lottery digit: "<<num_2<<endl;

num_3=rand()%10;

cout<<"Third lottery digit: "<<num_3<<endl;

// store random generated numbers and guess numbers in arrays to compare them

int num[3]= {num_1,num_2,num_3};

int guess[3]={guess_1,guess_2,guess_3};

// compare the arrays to find out how many are matching

   for(int i=0; i<3; i++)

   {

 for(int j=0; j<3; j++)

 {

  if(num[i]==guess[j])

  {    

   matches = matches + 1;

  }

 }

}

cout << "Total Matches are: " <<matches << endl;

// display reward according to the number of matches

if (matches==0)

cout<<"you won: $0"<<endl;

if (matches==1)

cout<<"you won: $10"<<endl;

if (matches==2)

cout<<"you won: $1000"<<endl;

if (matches==3)

cout<<"you won: $100000"<<endl;

return 0;

}

Output:

Enter first guess digit 0 to 9

7

Enter second guess digit 0 to 9

1

Enter third guess digit 0 to 9

5

First lottery digit: 3

Second lottery digit: 7

Third lottery digit: 2

Total Matches are: 1

You won: $10

Enter first guess digit 0 to 9

7

Enter second guess digit 0 to 9

3

Enter third guess digit 0 to 9

4

First lottery digit: 5

Second lottery digit: 4

Third lottery digit: 7

Total Matches are: 2

You won: $1000

5 0
3 years ago
Other questions:
  • Which of the below statements describes the nature of HTML elements - check as many as apply
    6·1 answer
  • A page with no meaningful content that is full of ads and the webmaster makes money from if someone clicks on them is called____
    7·1 answer
  • For safety, the lights on your vehicle must be in good working condition. Which statement about
    8·2 answers
  • Which among the following choices is correct based on the two statements listed below? Statement 1: When the lexical analyzer sc
    12·1 answer
  • What is the component on the motherboard that confirms all devices are in working order once the computer is turned on?
    13·1 answer
  • A company has a website that has seen a large increase in visitors and they are concerned that if the trend continues, the web s
    13·1 answer
  • 6.An organization wants to implement a remote dial-in server to ensure that personnel can connect to the organization's network
    11·1 answer
  • For how long should a media piece hold the user's attention?
    13·2 answers
  • How many passes will it take to find 30 using a binary search?
    6·1 answer
  • The data _____ component of a database management system (DBMS) is used to create and maintain the data dictionary.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!