Q3: Create a class called Employee that includes three instance variables—a first name (typeString), a last name (type String) and a monthly salary (double). Provide a constructor that initializesthe three instance variables. Provide a set and a get method for each instance variable. If the monthly salary is not positive, do not set its value. {Do not write a full program, only a class}

Answers

Answer 1

Answer:

Follows are the code to the given question:

public class Employee //defining a class Employee

{

String first_name,last_name;

Double monthly_salary;

Employee(String first_name,String last_name,Double monthly_salary)

{

   this first_name=f_name// initialize value in first_name

   this last_name = l_name; // initialize value in the last_name

    this monthly_salary = m_salary; // initialize value in the monthly_salary

if (monthly_salary < 0.0)//use if to check monthly_salary is positive

           monthly_salary = 0.0;//set value 0

}

void setfirst_name (String f_name)//defining set method to store first_name

{

first_name = f_name; //holding the value of first_name

}  

public String getfirst_name ()//defining get method to return first_name

{

return first_name;//return first_name

}  

public void setlast_name (String l_name)//defining set method to store last_name

{

last_name = l_name; // holding the value of the last_name

}

public String getlast_name ()//defining get method to return last_name

{

return last_name;//return last_name

}  

public void setmonthly_salary(double m_salary)//defining set method to store monthly_salary

{

monthly_salary = m_salary; // holding the value of the monthly_salary

}

public double getmonthly_salary ()//defining get method to return monthly_salary

{

return monthly_salary;//return monthly_salary  

}

}

Explanation:

In this code, a class "Employee" is declared that defines two string variables  "first_name,last_name", and one double variable "monthly_salary". In the next step, a parameterized constructor is defined that stores the value into the variable, and use if block to check "monthly_salary" is a positive. It also uses the getter and setter method to hold and return its value.  

   


Related Questions

3. Given the following total revenue functions, find the corresponding demand functions:

a) TR = 50Q-4Q²
b) TR = 10

Answers

a)TR=50Q4Q2 I hope.this helps

A) The demand function for the total revenue function TR = 50Q - 4Q² is;

P = 50 - 4Q

B) The demand function for  the total revenue function TR = 10 is; 10/Q

We are given total revenue functions as;

TR = 50Q - 4Q²

TR = 10

A) TR = 50Q - 4Q²

Formula for revenue function if Q represents the units demanded is;

TR = P × Q

Where P is the demand function

Thus;

50Q - 4Q² = PQ

Divide both sides by Q to get the demand function;

P = 50 - 4Q

B) TR = 10

Formula for revenue function if Q represents the units demanded is;

TR = P × Q

Where P is the demand function

Thus;

10 = P × Q

Divide both sides by Q to get the demand function;

P = 10/Q

Read more at;https://brainly.com/question/13701068

Are items a through e in the following list algorithm? If not, what qualities required of algorithms do they lack?
a. Add the first row of the following matrix to another row whose first column contains a nonzero entry. (Reminder: Columns run vertically; rows run horizontally.)
[1 2 0 4 0 3 2 4 2 3 10 22 12 4 3 4]
b. In order to show that there are as many prime numbers as there are natural numbers, match each prime number with a natural number in matching the first prime number with 1 (which is the first natural number) and the second prime number with 2, the third with 3, and so forth. If, in the end, it turns out that each prime number can be paired with each natural number, then it is shown that there are as many prime numbers as natural numbers.
c. Suppose you're given two vectors each with 20 elements and asked to perform the following operation. Take the first element of the first vector and multiply it by the first clement of the second vector. Do the same to the second elements, and so forth. Add all the individual products together to derive the dot product.
d. Lynne and Calvin are trying to decided who will take the dog for a walk. Lynne suggests that they flip a coin and pulls a quarter out of her pocket. Calvin does not trust Lynne and suspects that the quarter may be weighted (meaning that it might favor a particular outcome when tossed) and suggests the following procedure to fairly determine who will walk the dog.
1. Flip the quarter twice.
2. If the outcome is heads on the first flip and tails on the second, then I will walk the dog.
3. If the outcome is tails on the first flip, and heads on the second, then you will walk the dog.

Answers

Answer:

Following are the responses to the given points:

Explanation:

The following features must contain a well-specified algorithm:

Description [tex]\to[/tex] Exact measures described

Effective computation   [tex]\to[/tex]  contains steps that a computer may perform

finitude  [tex]\to[/tex]  It must finish algorithm.

In choice "a", there is little algorithm Because it does not stop, finiteness has already been incomplete. There is also no algorithm.

In choice "b", it needs productivity and computational burden. because it's not Enter whatever the end would be.

In choice "c", the algorithm is given the procedure. It fulfills all 3 algorithmic properties.

In choice "d", each algorithm is a defined process. Since it needs finitude.

1, How can technology serve to promote or restrict human rights? [2 points]

Answers

Answer:

Examples of how technology can be used as a powerful tool for human rights are ever expanding. Newer technologies such as artificial intelligence, automation, and blockchain have the potential to make significant positive contributions to the promotion and protection of human rights.

Was Nick Carson a good project manager? Why or why not?

Answers

Answer:

Nick Carson is not a good project manager because he did not focus on all aspects of the project. He also failed to provide accurate schedules and also detailed plans on the happenings of the project. He was performing other jobs leaving aside the work of project manager. Without concerning and understanding the problem of top management he delivered the project.

Explanation:

the _ and _ services help us to keep in touch with our family and friends

Answers

Answer:

Internet and communication technology

I need help Asap!!! So the question is "Compare and contrast Web page and Websites". ​

Answers

Answer:

A website is a mix of web pages while a web page is a single entity.

Explanation:

Methods ii.) Define and implement a method that takes a string array as a parameter and returns the length of the shortest and the longest strings in the array i.) Write a method that take an integer array as a parameter and returns the sum of positive odd numbers and sum of positive even numbers. iii.) Implements the sequential search method that takes and array of integers and the item to be search as parameters and returns true if the item to be searched in the array, return false otherwise

Answers

Answer:

Explanation:

Well I am sorry I don't know the answer anyway.

25 POINTS PLATO
Drag the tiles to the boxes to form correct pairs.
Pat creates a table in a spreadsheet program, starting at cell A1 and ending at cell B4. Column A contains words, while column B contains the words’ meanings. Pat wants to look up the meaning of the word "paramount", which is present in cell A3. How should Pat write the LOOKUP function? Refer to the syntax of the function and match the arguments in the syntax to their values.

Syntax: LOOKUP(lookup value; search table; result table)

B1:B4
"paramount"
A1:A4

lookup value
search table
result table

Answers

Answer:

lookup value   =  "paramount"

Search table   =  A1:A4

Result table     =  B1;B4

Explanation:

lookup, what are we looking up.....:::///????Paramount

What is the beginning search table......A1;A4

Column B contains the words meanings.....this is the result we want:

So the Result table......B1:B4

LOOKUP("paramount"; B1:B4; A1:A4)  should Pat write the LOOKUP function.

What is a LOOKUP function?

Lookup functions entail accessing a cell, comparing its values to those in an adjacent row or column, and then extracting the relevant answers from the associated columns or rows of Excel.

The lookup value, the search table, and indeed the result table are the three inputs required by the LOOKUP function. The value you are searching for, in this case, "paramount," is the lookup value.

The table that contains the lookup value, throughout this example B1:B4, is known as the search table.

The table where the results of the lookup are stored is known as the result table, and in this example, A1:

Pat should use the columns which would have the cell value of B1, B4 as well as A1.

Learn more about the LOOKUP function, here:

https://brainly.com/question/29517410

#SPJ3

Write a program that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score. Write the following methods in the program: calcAverage: This method should accept five test scores as arguments and return the average of the scores. determineGrade: This method should accept a test score as an argument and return a letter grade for the score, based on the following grading scale:

Answers

Answer:

See comment for complete question

#include <iostream>

using namespace std;

double calc_Average(double sc1, double sc2, double sc3, double sc4, double sc5){

   return (sc1 + sc2 + sc3 + sc4 + sc5)/5;

}

char determine_Grade(double score){

   char grade;

   if(score >= 90 && score <=100){

       grade = 'A';}

   else if(score >= 80 && score <90){

       grade = 'B';}

   else if(score >= 70 && score <80){

       grade = 'C';}

   else if(score >= 60 && score <70){

       grade = 'D';}

   else if(score <60){

       grade = 'F';}

   return grade;

}

int main(){

   double sc1,sc2, sc3, sc4, sc5;

   cout<<"Enter 5 scores: ";

   cin>>sc1>>sc2>>sc3>>sc4>>sc5;

   cout<<"Score: "<<sc1<<" Grade: "<<determine_Grade(sc1)<<endl;

   cout<<"Score: "<<sc2<<" Grade: "<<determine_Grade(sc2)<<endl;

   cout<<"Score: "<<sc3<<" Grade: "<<determine_Grade(sc3)<<endl;

   cout<<"Score: "<<sc4<<" Grade: "<<determine_Grade(sc4)<<endl;

   cout<<"Score: "<<sc5<<" Grade: "<<determine_Grade(sc5)<<endl;

   double Ave = calc_Average(sc1,sc2,sc3,sc4,sc5);

   cout<<"Average: "<<Ave<<" Grade: "<<determine_Grade(Ave)<<endl;

   return 0;

}

Explanation:

The program was written in C++. Because of the length of the explanation, I've added the explanation as an attachment where I used comments to explain the lines of the code.

You are going on vacation and want to take some work files. You need a storage device that is small enough to fit in your bag and preferably one that does not have plugs. Which device should you bring?


hard drive bus

flash drive

external hard drive

storage card

Answers

Answer:

Flash drive

Explanation:

We are supposed to go to the concert tomorrow, but it has been raining for three days straight. I just know that we won’t be able to go.

7. What is the author’s tone? ​

Answers

Its the worried tone

Hope this helps!

There Will Come Soft Rains is a warning story about nuclear war and how, in the end, technology won't keep us safe. In response to the atomic bombings of Hiroshima and Nagasaki, Bradbury penned the tale.

What author’s worried tone indicate about rain?

Ray Bradbury wrote the classic science fiction short tale “There Will Come Soft Rains” in 1950. The narrative is narrated in a detached, emotionless tone, as though the events that are taking place are a normal part of everyday life.

The story's meaning can be found in the story's complete lack of human beings, not even corpses.

Soft rain rays will appear in the short story. Bradbury creates a disorganized, somewhat post-apocalyptic atmosphere. To better understand the zeitgeist of the world, he employs a variety of literary techniques.

Therefore, It's the worried tone author’s.

Learn more about author’s here:

https://brainly.com/question/1308695

#SPJ5


Output devices include:
A) Printers, and Monitors
B) CPU
C) System Unit
D) None of the above

Answers

Answer:

CPU IS TH ANSWER BECAUSE IT IS OUT

when working with smart which tab would provide the ability to change the shape or size of the smart art shapes

Answers

It doesn’t change shape

Answer:

B) Format

Explanation:

Write code to take two words from the user. The program should convert these to lower case, then compare them: printing a positive number if string1 appears after string2 alphabetically, a negative number if string1 appears before string2 alphabetically and zero if the two strings are identical. Make sure your program does not produce any additional numerical output other than this number or it may not be graded correctly.

Answers

Answer:

Use compareTo.

Explanation:

import java.util.Scanner;

public class U2_L3_Activity_Three{

 public static void main(String[] args){

   Scanner scan = new Scanner(System.in);

   System.out.println("Enter first word: ");

   String word1 = scan.nextLine();

   System.out.println("Enter second word: ");

   String word2 = scan.nextLine();

//I had to make the string all lowercase or all uppercase for when I did this

   word1 = word1.toLowerCase();

   word2 = word2.toLowerCase();

   System.out.println("Result: " + word1.compareTo(word2));

 }

}

Following are the program to converting string value into lowercase and compare with an input string value.

Program Explanation:

Import package.Defining a class Dat.Inside the class defining the main method, and in the method, two string variable "string1, string2" is declared.After input, the value a "toLowerCase" method is used that converts string value into lower case.  After converting value into the lower case a "compareTo" method is used that compares value and prints its value.

Program:

import java.util.*;//import package for input  

public class Dat //defining a Dat

{

public static void main(String[] ax)//main method

{

String string1 ,string2; //defining String variable

Scanner sc = new Scanner(System.in);//creating Scanner class object to input value

System.out.println("Enter values: ");//print message

string1= sc.next();//input value

string2= sc.next();//input value

string1= string1.toLowerCase();//convert string value into LowerCase  

string2 = string2.toLowerCase();//convert string value into LowerCase

System.out.println("Result: " + string1.compareTo(string2));//using compareTo method

}

}

Output:

Please find the attached file.

Learn more:

brainly.com/question/15706308

Write the definition of the function inputArray that prompts the user to input 20 numbers and stores the numbers into alpha. Write the definition of the function double Array that initializes the elements of beta to two times the corresponding elements in alpha. Make sure that you prevent the function from modifying the elements of alpha. Write the definition of the function copy AlphaBeta that stores alpha into the first five rows of matrix and beta into the last five rows of matrix. Make sure that you prevent the function from modifying the elements of alpha and beta. Write the definition of the function printArray that prints any one-dimensional array of type int. Print 15 elements per line.

Answers

Answer:

In Java:

public static  int[] inputArray(){

   Scanner input = new Scanner(System.in);

   int[] alpha = new int[20];

   for(int i = 0;i<20;i++){

       alpha[i] = input.nextInt();

   }

   return alpha;}

public static  int[] doubleArray(int [] alpha){

   int[] beta = new int[20];

   for(int i = 0;i<20;i++){

       beta[i] = 2 * alpha[i];

   }

   return beta;

}

public static int[] copyAlphaBeta(int [] alpha, int [] beta){

   int [] AlphaBeta = new  int[10];

   for(int i = 0;i<5;i++){

       AlphaBeta[i] = alpha[i];

   }

   int count = 5;

   for(int i = 15;i<20;i++){

       AlphaBeta[count] = beta[i];

       count++;

   }

   return AlphaBeta;

}

public static void printArray(int [] alpha){

   for(int i = 0;i<20;i++){

       System.out.print(alpha[i]+" ");

       if((i+1)%15 == 0){

           System.out.println(" ");

       }

   }

}

Explanation:

The inputArray is defined here

public static  int[] inputArray(){

   Scanner input = new Scanner(System.in);

This declares alpha array of 20 elements

   int[] alpha = new int[20];

The following iteration gets input from the user into the array

   for(int i = 0;i<20;i++){

       alpha[i] = input.nextInt();

   }

This returns the alpha array

   return alpha;}

The doubleArray is defined here. It takes the alpha array as its input parameter

public static  int[] doubleArray(int [] alpha){

This declares beta of 20 integers

   int[] beta = new int[20];

This populates beta by 2 * alpha[i]

   for(int i = 0;i<20;i++){

       beta[i] = 2 * alpha[i];

   }

This returns the alpha array

   return beta;}

The copyAlphaBeta array is defines here

public static int[] copyAlphaBeta(int [] alpha, int [] beta){

This declares AlphaBeta as 10 elements

   int [] AlphaBeta = new  int[10];

This populates the first 5 elements of AlphaBeta with the first 5 of alpha

   for(int i = 0;i<5;i++){

       AlphaBeta[i] = alpha[i];

   }

   int count = 5;

This populates the last 5 elements of AlphaBeta with the last 5 of beta

   for(int i = 15;i<20;i++){

       AlphaBeta[count] = beta[i];

       count++;

   }

This returns the AlphaBeta array

   return AlphaBeta;

}

The printArray is defined here. It takes the alpha array as its input parameter

public static void printArray(int [] alpha){

This iterates through alpha array

   for(int i = 0;i<20;i++){

This prints each element of the array

       System.out.print(alpha[i]+" ");

A new line is started after the 15th element

       if((i+1)%15 == 0){

           System.out.println(" ");

       }

   }

}

See attachment for complete program which includes the main

Other Questions
Which would most help you choose a topic and theme for a reflective essay?Think about events that taught you something.Think about experiences you want to have.Think about possible future events that you dread.Think about all the events in your past. A figure is reflected across the x-axis, then reflected across the y-axis.Which of the transformations will not always produce the same result?A. Reflection of each point on the figure across the originB. Rotation of 180C. Reflection across the y-axis, then across the x-axisD. Reflection across the line y=x Which additional claim can be BEST supported by the evidence from the skulls in the whale fossil record? A. The fossil record shows differences in the skulls of the mammals, which shows that they are from three separate species that all lived at the same time. B. The fossil record shows similarities in the skulls of the mammals, which shows that they must have had similar habitats and environments. C. The fossil record shows that some mammals evolved so that their nostrils are further at the top of their skull for better breathing while in the water. D. The fossil record does not give enough evidence about the mammals to determine if there is a relationship between the three skulls. Mr. Toro saved up $440 from his salary to go on vacation. He wants to spend 20% of his savings on a ticket to Disneyland. How much did the ticket to Disneyland cost? Maintaining blood glucose levels is an important homeostatic activity of the body, not specifically because every cell of the body must have glucose but primarily because the brain relies on glucose for its metabolism.a. Trueb. False 2. In what state would you find the coordinates 39 N and 98W?a. Nevadac. Kansasd. North Dakotab. Maine An apparel manufacturing plant has estimated the variable cost to be $21 per unit. Fixed costs are $1M per year. Forty percent of its business is with one preferred customer and the customer is charged at cost. The remaining 60% of the business is with several different customers and they are charged at $35 per unit. Find (a) the breakeven volume for this job shop. (b) the unit cost if 100,000 units are made per year. (c) the annual profit for this quantity. 8 slices of pizza and 5 sodas cost $36.50. 4 Slices of pizza and 10 sodas cost $37. How much does a slice of pizza cost? How much does a soda cost?PLEASE HELP How many turning points are there in the graph of y = x^3 - 2x^2 - 2 ?A. 1B. 2C. 3D. 4 What line of code would you edit if you wanted a bigger sprite? Help pick branliest if right this is computer science.If you guys dont know dont answer or i report uA.3B.4C.5D.You have to edit it yourself A student investigated temperature changes during a reaction. Figure 2 shows the apparatus the student usesWhat is the biggest error in this investigation.Suggest two improvements to the apparatus which would increase the accuracy of the experiment. [3 marks] composition of my father in French Find the slope from the graph. What are three examples of protists?A.amoebaB.parameciumC.euglenaD.fungi PLEASE ANSWER ASAPPP!Joan Didions 1967 essay, Goodbye to All That, recounts the authors experiences as a young woman living in New York City. Didion describes how she loved New York at first, feeling it to be a place of such great possibility and wonder that it scarcely felt real to her. Later, however, Didion begins to feel unsettled and depressed in New York. She comes to believe that she can no longer manage the small tasks of everyday life.Write an analysis based on your close reading of the final section. In your analysis, be sure to include an analysis of the life choices Didion makes and the literary devices she uses to relate her experiences.https://genius.com/Joan-didion-goodbye-to-all-that-annotated To solve the system of linear equations 3 x + 5 y = 2 and 6 x + 10 y = 8 by using the linear combination method, Laura correctly multiplied the first equation by 2 to get Negative 6 x minus 10 y = negative 4 and then correctly added the equations Negative 6 x minus 10 y = negative 4 and 6 x + 10 y = 8 to get 0 = 4. How many solutions are there to the system of equations?0124 The desert climate or arid climate, is a climate which there is an excess of evaporation over precipitation. During the days, the temperatures are very high and dry. During nightfall, temperatures drop dramatically and it gets very cold. In three to four sentences, describe one plant and one animal that you would expect to find in the arid biome. Support your answer with the abiotic factors in the biome. * Explain the difference between nationalism and sectionalism 10. Johnny pushed a wheel borrow that was 50kg, if the net force on thewheel borrow is 15N east, what is the wheel borrows acceleration? Suppose a random variable, x, arises from a binomial experiment. If n = 25, and p = 0.85, find the variance. Round answer to 4 decimal places. Answer: