Write an application that calculates and displays the amount of money a user would have if his/her money could be invested at 5% 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

Answers

Answer 1
Answer:

Answer:

// Application in java.

// package

import java.util.*;

// class definition

class Main

{

  // method for calculating interest

  public static float calculateInterest(float start_bal,float i_Rate)

  {

  // calculate return

     float return_Amount=start_bal+(start_bal*(i_Rate/100));

     // return

    return return_Amount;

  }

// main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

         // scanner Object to read the input

         Scanner sc = new Scanner(System.in);

         // variables

         float start_bal;

         float i_Rate=5;

         // ask to enter start money

        System.out.print("Enter start money:");

        // read start money

        start_bal=sc.nextFloat();

        // call the function and print the return amount

        System.out.println("5% interest earned on $" + start_bal + " after one year is $" + calculateInterest(start_bal,i_Rate));

   }catch(Exception ex){

       return;}

}

}

Explanation:

Declare and initialize interest rate with 5.Then read the start money from user.Then call the method calculateInterest() with parameter start_bal and i_Rate.It will calculate the return amount after 1 year.Print the returned amount in main method.

Output:

Enter start money:1500

5% interest earned on $1500.0 after one year is $1575.0


Related Questions

List the various cases where use of a NULL value would be appropriate.
Help me! I’ll mark you brainly ! Please help me I need this now
Write a statement that assigns total_coins with the sum of nickel_count and dime_count. Sample output for 100 nickels and 200 dimes is: 300
You text file begins with the following rows. The pattern is a description of the item to be repaired, its color, and the issue. bike, red, flat tire bike, blue, broken chain skate, blue, loose wheel mitt, red, torn lace Your program starts with the following lines. import csv aFile = open("data\broken.txt","r") aReader = csv.reader(aFile) countRed = 0 for item in aReader: When you write code to count the number of times red is the color, what is the index of "red"?
An example of negative self-talk is:

What character makes an assignment statement an assignment statement?

Answers

Answer:

'='

Explanation:

The equal ('=') is the character that is used to assign the value in the programming.

In the programming, there is a lot of character which has different meaning and uses for a different purpose.

like '==' it is used for checking equality between the Boolean.

'+' is a character that is used for adding.

'-'  is a character that is used for subtraction.

similarly, '=' used for assigning.

for example:

a = a + b;

In the programming, the program evaluates the (a + b) first and then the result assigns to the variable.

An analyst receives an alert from the SIEM showing an IP address that does not belong to the assigned network can be seen sending packets to the wrong gateway. Which of the following network devices is misconfigured and which of the following should be done to remediate the issue? A. Firewall; implement an ACL on the interface B. Router; place the correct subnet on the interface C. Switch; modify the access port to trunk port D. Proxy; add the correct transparent interface

Answers

Answer: (A)  Firewall; implement an ACL on the interface

Explanation:

 According to the question, for re-mediate the issue firewall should be implemented the ACL (Access control list) on the given interface. The access control list is one of the type of logic which selectively give permission or deny the number of packet in the system which to through the interface.

Firewall is the type of device that basically examine the traffic in the network system and also make several decisions in the system. ACL is the set of rule which mainly define the route of the packet in the router interface state.

Write a program that meets the following requirements.Create two stages in a program
Create a pane using FlowPane in each stage
Add three buttons to each pane
Directions
Create a class named FlowPaneDemo extends Application
Create user interface using FlowPane
Add the instances of 3 Buttons to pane1 created by FlowPane and other 3 instances of Buttons using FlowPane to pane2
Create scene1 for pane1 with a specific size and scene2 for pane2 with a different size
Set different titles to two stages and display two stages
The output should look like the screen below
Provide appropriate Java comments

Answers

Answer:

import javafx.application.Application;

import javafx.scene.Scene;

import javafx.scene.layout.FlowPane;

import javafx.stage.Stage;

import javafx.scene.control.Button;

public class FlowPaneDemo extends Application {

  public void start(Stage primaryStage) {

      // TODO Auto-generated method stub

      //Creates a FlowPane for each stage.

      FlowPane paneOne = new FlowPane();

      FlowPane paneTwo = new FlowPane();

     

      //Creates six Buttons, three for each Flow Pane.

      Button buttonOne = new Button("Button One");

      Button buttonTwo = new Button("Button Two");

      Button buttonThree = new Button("Button Three");

      Button buttonFour = new Button("Button Four");

      Button buttonFive = new Button("Button Five");

      Button buttonSix = new Button("Button Six");

     

      //Adds the Buttons to the two FlowPanes.

      paneOne.getChildren().add(buttonOne);

      paneOne.getChildren().add(buttonTwo);

      paneOne.getChildren().add(buttonThree);

     

      paneTwo.getChildren().add(buttonFour);

      paneTwo.getChildren().add(buttonFive);

      paneTwo.getChildren().add(buttonSix);

     

      //Creates two Scenes, using each of the FlowPanes.

      Scene sceneOne = new Scene(paneOne, 250, 600);

      Scene sceneTwo = new Scene(paneTwo, 320, 400);

     

      //Makes a second Stage.

      Stage secondaryStage = new Stage();

     

      //Set the title and Scenes for the two Stages.

      primaryStage.setTitle("First Stage");

      primaryStage.setScene(sceneOne);

     

      secondaryStage.setTitle("Second Stage");

      secondaryStage.setScene(sceneTwo);

     

      //Runs the show methods for the two Stages.

      primaryStage.show();

      secondaryStage.show();

  }

  public static void main(String[] args){

      //Runs the launch method to start a stand-alone JavaFX application; only needed

      //as I am running this in Eclipse.

      Application.launch(args);

  }

}

suppose you have to implement an operating system on hardware that supports interrupts and exceptions but does not have an explicit trap (syscall) instruction. Can you devise a satisfactory substitute for traps using interrupts and/or exceptions? If so, explain how. If not, explain why. (In this context, the trap instruction is the instruction used by a user-level process to invoke a system call in the operating system, i.e., the trap instruction is the system call instruction

Answers

A trap is nothing but an exception that is caused by an abnormal condition. It is also used to invoke a system call or kernel routine because this has a higher priority than the user’s code. An interrupt is a response generated by the hardware which will occur at random times during the execution of the program. However, we cannot devise a substitute for traps using interrupts and exceptions because of the following reasons:

1. The interrupts are asynchronous whereas the exceptions and the traps are said to be synchronous.

2. The traps and exceptions can be manipulated or called whenever required whereas interrupts occur mostly at unwanted and random times.

To stop a process from happening, Ctrl + C is also done which is a user-defined interrupt in DOS operating systems

2. Use inheritance to create a hierarchy of Exception classes -- EndOfSentenceException, PunctuationException, and CommaException. EndOfSentenceException is the parent class to PunctuationException, which is the parent class to CommaException. Test your classes in a Driver class with a main method that asks the user to input a sentence. If the sentence ends in anything except a period (.), exclamation point (!), or question mark (?), the program should throw a PunctuationException. If the sentence specifically ends in a comma, the program should throw a CommaException. Use a catch block to catch all EndOfSentenceExceptions, causing the program to print a message and terminate. If a general PunctuationException is caught, the program should print "The sentence does not end correctly." If a CommaException is caught, the program should print "You can't end a sentence in a comma." If there are no exceptions, the program should print "The sentence ends correctly." and terminate.

Answers

Answer:

See explaination

Explanation:

EndOfSentenceException.java

//Create a class EndOfSentenceException that

//extends the Exception class.

class EndOfSentenceException extends Exception

{

//Construtor.

EndOfSentenceException(String str)

{

System.out.println(str);

}

}

CommaException.java

//Create a class CommaException that extends the class

//EndOfSentenceException.

class CommaException extends EndOfSentenceException

{

//Define the constructor of CommaException.

public CommaException(String str)

{

super(str);

}

}

PunctuationException.java

//Create a class PunctuationException that extends the class

//EndOfSentenceException.

class PunctuationException extends EndOfSentenceException

{

//Constructor.

public PunctuationException(String str)

{

super(str);

}

}

Driver.java

//Include the header file.

import java.util.Scanner;

//Define the class Driver to check the sentence.

public class Driver {

//Define the function to check the sentence exceptions.

public String checkSentence(String str)

throws EndOfSentenceException

{

//Check the sentence ends with full stop,

//exclamation mark

//and question mark.

if(!(str.endsWith(".")) && !(str.endsWith("!"))

&& !(str.endsWith("?")))

{

//Check the sentence is ending with comma.

if(str.endsWith(","))

{

//Throw the CommaException.

throw new CommaException("You can't "

+ "end a sentence in a comma.");

}

//Otherwise.

else

{

//Throw PunctuationException.

throw new PunctuationException("The sentence "

+ "does not end correctly.");

}

}

//If the above conditions fails then

//return this message to the main function.

return "The sentence ends correctly.";

}

//Define the main function.

public static void main(String[] args)

{

//Create an object of Scanner

Scanner object = new Scanner(System.in);

//Prompt the user to enter the sentence.

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

String sentence=object.nextLine();

//Begin the try block.

try {

//Call the Driver's check function.

System.out.println(new

Driver().checkSentence(sentence));

}

//The catch block to catch the exception.

catch (EndOfSentenceException e)

{}

}

}

Which of the following statements is NOT true regarding the Security Configuration and Analysis (SCA) tool?a. It evaluates the current security state of computers in accordance with Microsoft security recommendations.
b. It allows an administrator to analyze a computer and compare its configuration settings with a baseline.
c. It can apply a baseline to force current computer settings to match the settings defined in the baseline.
d. It uses security templates to store the settings that make up baselines.

Answers

Answer: a. It evaluates the current security state of computers in accordance with Microsoft security recommendations

Explanation:

The Security Configuration and Analysis tool allows the configuration of local computers through the application of the settings in a security template to the local policy.

This allows an administrator to analyze a computer and compare its configuration settings with a baseline. The Security Configuration and Analysis (SCA) tool also uses security templates to store the settings that make up baselines.

Therefore, based on the options given, the correct option is A as the SCA tool doesn't evaluate the current security state of computers in accordance with Microsoft security recommendations.