Question

In: Computer Science

Question 1 Please create three different types of variables and assign three different values into the...

Question 1

Please create three different types of variables and assign three different values into the variables.

Please create a new variable and assign the sum of two variables above.

Please display all the data (four data here) as a line.

Question 2

using Scanner, take three inputs from a user (job level, the number of years in company, and job title) and display yearly bonus percentage based in the following rule:

job level : 1 to 10

Job title : Manager, Developer, QA

job level from 1 to 3: 5%

job level from 4 to 6: 10%

job level from 7 to 10: 15%

if job title is manger, then add 5% more

If an employee spends more than 10 years, then add 5% more.

e.g.

Please type your job level? 3

Please type your job title? Manager

Please type the number of year in Companay? 5

Okay, your bonus rate is 10%

Question 3

From Question 2, if the user types wrong job level, please catch and asking again until the user types the right value.

From Question 2, if the user types wrong job title, please catch and asking again until the user types the right value

Then, display the final bonus rate.

Question 4

Take two numbers with Scanner.

please display sum of all the numbers between two numbers (exclude the start number and the end number) except for odd numbers.

e.g.

Please type a start number: 10

please type an end number: 20

okay, the sum of all the even numbers between 11 and 19 is 60

Solutions

Expert Solution

Q1- Question is not clear as it says in first line to declare 3 variables, and in 2nd line it says to add the two variable declared but we declared three, which is why I don't want to wrong answer, please clear the question in comment section, then I can add the solution for this as well.

Q2-

import java.util.*;

class Main{

public static void main(String args[]){

String position;

int jobLevel,years,bonusRate;

Scanner sc=new Scanner(System.in);

System.out.print("Please type your Job Level(1-10)?: ");

jobLevel=sc.nextInt();

System.out.print("Please type your Job Title(Manager,Developer,QA): ");

position=sc.next();

System.out.print("Please type the Number of years in company: ");

years=sc.nextInt();

if(jobLevel>=1 && jobLevel<=3)

bonusRate=5;

else if(jobLevel>=4 && jobLevel<=6)

bonusRate=10;

else if(jobLevel>=7 && jobLevel<=10)

bonusRate=15;

else

bonusRate=0;

if(position.equalsIgnoreCase("Manager"))

bonusRate+=5;

if(years>10)

bonusRate+=5;

System.out.println("Okay, your bonus rate is "+bonusRate+"%");

}

}

Question 3-

import java.util.*;

class Main{

public static void main(String args[]){

String position;

int jobLevel,years,bonusRate;

Scanner sc=new Scanner(System.in);

do{

System.out.print("Please type your Job Level(1-10)?: ");

jobLevel=sc.nextInt();

}while(jobLevel>10 || jobLevel<=0);

do{

System.out.print("Please type your Job Title(Manager,Developer,QA): ");

position=sc.next();

}while(!(position.equalsIgnoreCase("Manager") || position.equalsIgnoreCase("Developer") || position.equalsIgnoreCase("QA")));

System.out.print("Please type the Number of years in company: ");

years=sc.nextInt();

if(jobLevel>=1 && jobLevel<=3)

bonusRate=5;

else if(jobLevel>=4 && jobLevel<=6)

bonusRate=10;

else if(jobLevel>=7 && jobLevel<=10)

bonusRate=15;

else

bonusRate=0;

if(position.equalsIgnoreCase("Manager"))

bonusRate+=5;

if(years>10)

bonusRate+=5;

System.out.println("Okay, your bonus rate is "+bonusRate+"%");

}

}

Question 4-

import java.util.*;

class Main{

public static void main(String args[]){

Scanner sc=new Scanner(System.in);

int a,b,sum=0;

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

a=sc.nextInt();

System.out.print("Enter end Number: ");

b=sc.nextInt();

for(int i=a+1;i<b;i++){

if(i%2==0)

sum+=i;

}

System.out.println("okay, the sum of all the even numbers between "+(a+1)+" and "+(b-1)+" is "+sum);

}

}

if you like the answer please provide a thumbs up.


Related Solutions

PLEASE ANSWER THIS QUESTION WITH THESE VALUES NOT ONE YOU ANSWERED WITH DIFFERENT VALUES!!! THANKS A...
PLEASE ANSWER THIS QUESTION WITH THESE VALUES NOT ONE YOU ANSWERED WITH DIFFERENT VALUES!!! THANKS A radio broadcast antenna is 36.00 km from your house. Suppose an airplane is flying 2.200km above the line connecting the broadcast antenna and your radio, and that waves reflected from the airplane travel 85.00 wavelengths farther than waves that travel directly from the antenna to your house. Part A Do you observe constructive or destructive interference between the direct and reflected waves? (Hint: Does...
Create three 8-bit variables in the “.text” section and initialize it to any values you like....
Create three 8-bit variables in the “.text” section and initialize it to any values you like. Load three registers (R1, R2, and R3) using the initialized values. Now, add the values of register R2 and R3 and store the result on the stack. Multiply the content of R1 and top of the stack, and again store the result on to the stack. Make sure to use appropriate instructions. (ARM assembly language)
Question 1: The response time in milliseconds was determined for three different types of circuits in...
Question 1: The response time in milliseconds was determined for three different types of circuits in an electronic calculator. The results are recorded here. Circuit Type Response 1 19 22 20 18 25 2 20 21 33 27 40 3 16 15 18 26 17 Using α = 0.05, test the hypothesis that the three circuit types have the same response time. What is the p-value? Analyze the residuals from this experiment. If there is a significant difference, perform a...
Question 1 Zoom Corporation manufactures and sells three different types of binoculars. They are referred to...
Question 1 Zoom Corporation manufactures and sells three different types of binoculars. They are referred to as Good, Better, and Best binoculars. Grinding and polishing time is limited. More time is required to grind and polish the lenses used in the Better and Best binoculars. Additional information is provided below. Product Good Better Best Selling price $100.00 $304.20 $870.00 Variable costs and expenses 52.00 182.00 485.00 Contribution margin $48.00 $122.20 $385.00 Grinding and polishing time required 0.6 hrs 1.3 hrs...
Create your own data type using a C++ structure. Assign values to a variable of that...
Create your own data type using a C++ structure. Assign values to a variable of that data type. Retrieve values from the variable of that data type. Description: In this lab you will choose the statements to create a program that: Creates a brand new data type called "Monster". Once created, creates a variable of type Monster and assign values to the variable and then display the contents. This lab will again take the form of a guided multiple-choice quiz...
For the following types of values, designate discrete variables (D) and continuous variables (C): (a) weight...
For the following types of values, designate discrete variables (D) and continuous variables (C): (a) weight of the contents of a package of cereal, (b) diameter of a bearing, (c) number of defective items produced, (d) number of individuals in a geographic area who are collecting unemployment benefits, (e) the average number of prospective customers contacted per sales representative during the past month, (f) dollar amount of sales.
write a program that evaluates the following arithmetic expression: ((A+B)/C)*((D-A)+E). Assign test values to the variables...
write a program that evaluates the following arithmetic expression: ((A+B)/C)*((D-A)+E). Assign test values to the variables and display the resulting value.
Please suggest two different types of random variables from your daily life. Specify the type of...
Please suggest two different types of random variables from your daily life. Specify the type of the random variables you are proposing. Explain the measurement unit and frequency of the variables. Elaborate on the probability distribution of those random variables. Propose a visual tool for presentation of those random variables.
Please assist with this question (15) Compare the different types of methods which are used for...
Please assist with this question (15) Compare the different types of methods which are used for tuning valves, such as outlining the advantages and disadvantages of each. Compare at least four different methods
1.) Suppose we have the following values for a dependent variable, Y, and three independent variables,...
1.) Suppose we have the following values for a dependent variable, Y, and three independent variables, X1, X2, and X3. The variable X3 is a dummy variable where 1 = male and 2 = female:X X1 X2 X3 Y 0 40 1 30 0 50 0 10 2 20 0 40 2 50 1 50 4 90 0 60 4 60 0 70 4 70 1 80 4 40 1 90 6 40 0 70 6 50 1 90 8...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT