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

Write a c statement to declare variables of primitive data types, and assign values to the...
Write a c statement to declare variables of primitive data types, and assign values to the variables. Use common control structure in c, such as if, switch, break, for, while statements. Write a c program that takes command line parameters, and perform some computation based on the command line input. Write c statements to generate random number within a certain range. Write a c statement to declare array variables of primitive data types, and assign values to the elements of...
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...
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...
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)
Unix Create a script that will declare an array and assign four values from the command...
Unix Create a script that will declare an array and assign four values from the command line. 1. Use these four values - Paul, Ringo, George, John, - in that order 2. Display the content of the array, displaying the values in this format and this order The first array value is "John" The second array value is "Paul" The third array value is "George" The fourth array value is "Ringo"
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...
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.
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...
Create a Java class named Trivia that contains three instance variables, question of type String that...
Create a Java class named Trivia that contains three instance variables, question of type String that stores the question of the trivia, answer of type String that stores the answer to the question, and points of type integer that stores the points’ value between 1 and 3 based on the difficulty of the question. Also create the following methods: getQuestion( ) – it will return the question. getAnswer( ) – it will return the answer. getPoints( ) – it will...
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.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT