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]
3 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]3 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
Website administrators relay on ______, which is data such as the number of users who commented on, shared, viewed, or liked web
marin [14]

Answer:

b. analytics

Explanation:

-Hits are the amount of times that a website or program has been accessed.

-Analytics refers to the analysis of data to be able to make favorable decisions.

Cookies are files that are saved in a computer that are used to track the activity of a user in a website.

-Benchmaking is a technique in which a company compares its performance with businesses in the same industry.

According to this, the answer is that website administrators relay on analytics, which is data such as the number of users who commented on, shared, viewed, or liked webpage content.

3 0
3 years ago
Read 2 more answers
How do you join The Meeting on zoom because I have class Tomorrow with My Teacher
Svetllana [295]

Answer:

Go to join.zoom.us. Enter your meeting ID provided by the host/organizer. Click Join. When asked if you want to open zoom.us, click Allow.

Explanation:

3 0
3 years ago
Read 2 more answers
The following program uses a variable workHoursPerWeek rather than directly using 40 in the salary calculation expression.
Serjik [45]

Answer:

<u> Initial program output (from original program)</u>

Annual salary is: 40000

Monthly salary is: 3333

<u>Program output after workHoursPerWeek = 35</u>

Annual salary is: 35000

Monthly salary is: 2916

<u>Revised program (using variable workWeeksPerYear)</u>

  1.    public static void main(String[] args) {
  2.        int hourlyWage = 20;
  3.        int workHoursPerWeek = 35;
  4.        int workWeeksPerYear = 52;
  5.        int annualSalary = 0;
  6.        annualSalary = hourlyWage * workHoursPerWeek * workWeeksPerYear;
  7.        System.out.print("Annual salary is: ");
  8.        System.out.println(annualSalary);
  9.        System.out.print("Monthly salary is: ");
  10.        System.out.println((hourlyWage * workHoursPerWeek * workWeeksPerYear) / 12);
  11.        return;
  12.    }

Program output:

Annual salary is: 36400

Monthly salary is: 3033

<u>Revised Program after introducing monthly salary</u>

  1.    public static void main(String[] args) {
  2.        int hourlyWage = 20;
  3.        int workHoursPerWeek = 35;
  4.        int workWeeksPerYear = 52;
  5.        int annualSalary = 0;
  6.        int monthlySalary = 0;
  7.        
  8.        annualSalary = hourlyWage * workHoursPerWeek * workWeeksPerYear;
  9.        monthlySalary = hourlyWage * workHoursPerWeek * workWeeksPerYear;
  10.        
  11.        System.out.print("Annual salary is: ");
  12.        System.out.println(annualSalary);
  13.        System.out.print("Monthly salary is: ");
  14.        System.out.println((monthlySalary) / 12);
  15.        return;
  16.    }

Explanation:

One reason to use variable to replace the magic number is to improve the readability of the program. If we compared the revised version of the program with the original program, we will find that the variable enable our code easier to understand.

Besides, if we wish to change the value (e.g. working hours per year or per month), we just need to adjust the value assigned on the variables. The variables provide a single access point to get or change the value.

7 0
3 years ago
Create a class called Minimum that provides a single class method min. min should take an array of any object that implements Co
kaheart [24]

Answer:

The required code is given below:

Explanation:

public class Minimum {

   public static Comparable min(Comparable[] values) {

       if (values == null || values.length == 0) {

           return null;

       } else {

           Comparable minValue = values[0];

           for (int i = 0; i < values.length; i++) {

               if (values[i].compareTo(minValue) < 0) {

                   minValue = values[i];

               }

           }

           return minValue;

       }

   }

}

7 0
4 years ago
Ed wants to make sure that his system is designed in a manner that allows tracing actions to an individual. Which phase of acces
tatiyna

The phase of access control that one can say that Ed is more concerned about is called Accountability.

<h3>What is accountability?</h3>

Accountability is known to be one that removes the time and effort you that is used on distracting activities and a lot of unproductive behavior and it makes one to be more focused.

Hence, The phase of access control that one can say that Ed is more concerned about is called Accountability.

Learn more about Accountability from

brainly.com/question/27958508

#SPJ1

7 0
2 years ago
Other questions:
  • Seasons Write a program that takes a date as input and outputs the date's season. The input is a string to represent the month a
    14·1 answer
  • How do you scan a qr code on your iPhone
    5·2 answers
  • What is it called when you give credit in your writing to someone else's quote?
    10·1 answer
  • In a database, __________ is used to uniquely identify each record for retrieval or manipulation. answer an attribute or a field
    7·1 answer
  • Deon is required to provide the citation information for his sources. What type of information should he collect from his source
    10·2 answers
  • Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 te
    13·1 answer
  • For a loop counter, the appropriate data type would be:
    9·1 answer
  • What is a filter in excel (please keep your answer brief)
    11·1 answer
  • How do i work this out? does anyone do programming?
    7·1 answer
  • Which of the following are pointers?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!