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
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.
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.
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
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);
}
}
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
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)
{}
}
}
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.
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.