Questions
Complete the program below in order to make run properly by competing validName methods and add...

Complete the program below in order to make run properly by competing validName methods and add trycatch block in the main method.

public class ExceptionWithThrow {

public static String validName(String name) throws InputMismatchException{

// check here if the name is a valid name

// through InputMismatchException if invalid //throw

// return the name if it is valid

}

public static void main(String[] args) {

// Ask the user to enter a name and their validity through validName method

// Add try and catch block around appropriate statements

}

}

In Java Please!

In Java Please!

In Java Please!

In Java Please!

In Java Please!

In: Computer Science

There are two lights that blink at regular intervals. When each one blinks, it turns on...

There are two lights that blink at regular intervals. When each one blinks, it turns on and then immediately back off; they don’t toggle. They are both off at time t=0t=0. The first one blinks at t=p,2p,3p,…t=p,2p,3p,… seconds; the second one blinks at t=q,2q,3q,…t=q,2q,3q,… seconds. Once they start, they both keep blinking forever. It is very exciting to see them blink at the same time (on the same second). But your patience is going to run out eventually, in ss seconds. Will they blink at same time between t=1t=1 and t=st=s (inclusive)? Write a program that can answer this question, quick, before they start blinking again!

In: Computer Science

Question 4 For a family day function at Wawasan Open University, the computer department is going...

Question 4

For a family day function at Wawasan Open University, the computer department is going to conduct quiz session to give prizes to the participants. They need the sample software to conduct this quiz session. The prototype software contains two sample questions.

First, display question 1. Give 30 seconds to answer the question, showing the countdown.

If answered correctly, move to question 2 else if time out or wrong answer, prompt other participants to try to answer with another 10 second before moving to next question. End the session.

language C

In: Computer Science

Specifications Create an abstract Employee class that provides private attributes for the first name, last name,...

Specifications

  • Create an abstract Employee class that provides private attributes for the first name, last name, email address, and social security number. This class should provide functions that set and return the employee’s first name, last name, email address, and social security number. This class has a function: get_net_income which returns 0.
  • Create a Manager class that inherits the Employee class. This class should add private attributes for years of experience and the annual salary. This class should also provide necessary set and get functions. It should add a bonus ($1,000/year of experience) to the annual salary. The income tax rate should be 30%. This class should override the get_net_income function of the Employee class. Note that the gross income is calculated as follows:
    • bonus = years of experience * 1000
    • gross income = annual salary + bonus
    • tax rate = 30%
    • income tax = gross income * tax rate
    • net income = gross income - income tax
  • Create a Representative class that inherits the Employee class. This class should add private attributes for the weekly hours of work and the pay rate. This class should also provide necessary set and get functions. The income tax rate should be 20%. This class should override the get_net_income function of the Employee class. Note that the gross income is calculated as follows:
    • gross income = weekly hours of work * 52 * pay rate
    • tax rate = 20%
    • income tax = gross income * tax rate
    • net income = gross income - income tax
  • In the main function, the program should create Manager or Representative objects from the data entered by the user and save them in a list named employees. After the user has terminated data entries, your program should display the information of all employees on the output with this format: last name, first name, email, social security number, net income.

Sample Output (Your output should be similar to the text in the following box)

Welcome to my app

EMPLOYEE DATA ENTRY

Manager or Representative? (m/r): d

Invalid selection.

Continue? (y/n): y

Manager or Representative? (m/r): m

First Name: Frank
Last Name: Wilson
Email Address: [email protected]
SSN: 111-22-3333
Years of Experience: 3
Annual Salary: 95000

Continue? (y/n): y

Manager or Representative? (m/r): r

First Name: John
Last Name: Atkins
SSN: 222-33-4444
Email Address: [email protected]
Weekly Hours of Work: 40
Pay Rate: 20

Continue? (y/n): n

EMPLOYEE INFORMATION
Wilson, Frank, [email protected], 111-22-3333, $68600.00
Atkins, John, [email protected], 222-33-4444, $33280.00

Thank you for using my app

In: Computer Science

Subject: Software, Architecture Design and Testing You are to determine the user requirements for a web...

Subject: Software, Architecture Design and Testing

You are to determine the user requirements for a web phone-mail product. The primary purpose of this product is to give phone-mail users (e.g., faculty and staff) the ability to access the functionality of the phone-mail system from a web page. In general, the product should enable users of the phone-mail system to do their usual phone-mail activities via a web page.

  1. Evaluate these requirements. Do your requirements satisfy the eight criteria: Understandable, Verifiable, Independent of implementation, Consistent, Complete, Unambiguous, Realistic, Necessary? Explain your answers. Weed out any requirements that you do not think are good user requirements.
  1. Prioritize the requirements as to whether they are (1) absolutely necessary, (2) desirable, or (3) optional.

In: Computer Science

Question Block elements v.s. inline elements. <!DOCTYPE html> <html> <head> <style>     body{                      text-

Question

Block elements v.s. inline elements.

<!DOCTYPE html>

<html>

<head>

<style>

    body{

                     text-align: center;

    }

    .textdiv {

       background-color: LightSlateGrey;

       width: 50%;

    }

    .imgdiv {

                     background-color: PapayaWhip;

                  width: 30%;

    }

</style>

</head>

<body>

    <h2>Center Me</h2>

    <p>"Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."</p>

    <div class="textdiv">

                  Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

    </div>

    <img src="imgs/one.png" alt="">

    <div class="imgdiv">

        <img src="imgs/two.png" alt="">

    </div>

</body>

</html>

Step 1. Review the difference between block element and inline element from the reference (Links to an external site.).

Step 2. The CSS text-align property is used for aligning the inner content of a block element.

  • To align content center, use text-align: center;
  • To center align a block element itself, use margin: auto; which evenly set the right and left margin of the element.

To do:  Uncomment line 6 in center-ex1.html. Check if all the Lorem Ipsum text on page is centered. Can you explain why some text is not centered. Fix this problem and center all text by adding a single CSS rule in the CSS class selector textdiv.

Step 3.

To center align an <img> element, which is an inline element, you can use different approaches.

Approach 1: Use text-align: center; to center the image within its parent container.

Approach 2: Turn the <img> into a block element by changing its display property from the default inline value to block: display: block; and then use margin: auto; so the image is centered within its parent container.

To do: Add a single rule in the CSS class selector. imgdiv to center the "number two" image on the page.

In: Computer Science

Q7. Does Simulated Anealing (with 10 iterations) solve the 14-Queens Problem? What about SA (with 50...

Q7. Does Simulated Anealing (with 10 iterations) solve the 14-Queens Problem? What about SA (with 50 iterations). Show your answer.

In: Computer Science

Write a function to sort data (in increasing order) in an array using a. pass by...

Write a function to sort data (in increasing order) in an array using a. pass by value b. and pass by reference.

In: Computer Science

Lab Assignment Write a Java program that implements a queue in a hospital. I want your...

Lab Assignment

Write a Java program that implements a queue in a hospital. I want your program to ask the user to enter the number of patients then enter the patient number starting from 110 till the end of the queue then print number of patients waiting in the queue.

Suppose you have a queue D containing the numbers (1,2,3,4,5,6,7,8), in this order. Suppose further that you have an initially empty Stack S. Give a code fragment that uses S, to store the elements in the order (8,7,6,5,4,3,2,1) in D.

Q. What values are returned during the following sequence of queue operations, if executed on an initially empty queue?

enqueue(5), enqueue(3), dequeue(),

enqueue(2), enqueue(8), dequeue(), dequeue(), enqueue(9), enqueue(1),

dequeue(), enqueue(7), enqueue(6), dequeue(), dequeue(), enqueue(4),

dequeue(), dequeue().

In: Computer Science

Sub: cloud computing Based on below scenario answer the question With DTGOV’s client portfolio expanding to...

Sub: cloud computing

Based on below scenario answer the question

With DTGOV’s client portfolio expanding to include public-sector organizations, many of it cloud computing policies have become unsuitable and require modification. Considering that public-sector organizations frequently handle strategic information, security safeguards needs to be established to protect data manipulation and to establish a means of auditing activities that may impact government operations.
What security measures would have been implemented by DTGOV to resolve this?

In: Computer Science

Write a program in java that asks the name of the buyer and the number of...

Write a program in java that asks the name of the buyer and the number of shares bought. Your program must then calculate and display the following. sold stock/shares to the general public at the rate of $24.89 per share. Theres a 2 percent (2%) commission for the transaction.

Outputs need

Amount paid for buying the stock ($)

Amount paid for the commission ($)

Total amount ($)

In: Computer Science

Subject: cloud computing Based on below case, answer the question The migration of applications to ATN’s...

Subject: cloud computing

Based on below case, answer the question

The migration of applications to ATN’s new PaaS platform was successful, but also raised a number of new concerns pertaining to the responsiveness and availability of PaaS-hosted IT resource. ATN intends to move more applications to a PaaS platform, but decides to do so by establishing a second PaaS environment with a different cloud provider. This will allow them to compare cloud providers during a three month assessment period. Discuss on what different features the organization will consider when planning to make a comparison

In: Computer Science

AverageGrade. Assume the professor gives five exams during the semester with grades 0 through 100 and...

AverageGrade. Assume the professor gives five exams during the semester with grades 0 through 100 and drops one of the exams with the lowest grade. Write a program to find the average of the remaining four grades. The program should use a class named Exams that has

1. An instance variable to hold a list of five grades,

2. A method that calculate and return average.

3. A string that return the “exams Average” for printing.

Your program output should prompt for an input for each grade. Use any number between 0 and 100. Your submission should include compiled output.

In: Computer Science

Discuss the importance of SCM for Travelfast. Evaluate few SCM solutions available, and suggest which solution...

Discuss the importance of SCM for Travelfast. Evaluate few SCM solutions available, and suggest which solution would be appropriate for Travelfast. What are some of the possible challenges Travelfast will face in implementing for adoption of SCM in Travelfast.travel fast is an imaginary based on transport company this is for essay so provide a long answer

I have to write 2500 words so could you plz provide like around 1500 words answer it would be great

In: Computer Science

The signature of each function is provided below, do not make any changes to them otherwise...

The signature of each function is provided below, do not make any changes to them otherwise the tester will not work properly. The following are the functions you must implement:

mashup(lst) [20pts]

Description: Creates a new string that is based on the provided list. Each number in the list specifies how many characters from the string that follows belong in the resulting string. Parameters: lst is a list of variable size, that contains alternating ints and strings Assumptions: When a pair of values doesn’t make sense, throw out that pair. When you have an empty string in the list, move on to the next pair. When you have a number that is larger than the length of the string, move on to the next pair, etc. Return value: the new string that is generated from the replacements Examples: mashup([2, 'abc', 1, 'def']) → 'abd' mashup([3, 'rate', 2, 'inside', 1, 'goat']) → 'rating'

expand(numbers, amount) [20pts]

Description: Given a list of numbers it returns that same list that has been expanded with a certain amount of zeroes around all of the numbers, including at the beginning and end of the list. Parameters: numbers is a list of mixed int and float Assumptions: You will always have at least one element in numbers. amount will be >= 0 Return value: Nothing is returned. The swapping occurs in-place, i.e. you modify numbers itself Examples: ls = [1,2,3] expand(ls, 1) # nothing is returned! print(ls) # prints [0,1,0,2,0,3,0] ls = [1.5, -6, 4, 0] expand(ls, 2) # nothing is returned! print(ls) # prints [0, 0, 1.5, 0, 0, -6, 0, 0, 4, 0, 0, 0, 0, 0]

Assumptions for the following two problems: There will be at least one row and one column in the matrix. All rows will have the same number of elements.

squarify(matrix) [25pts]

Description: Determine the size of the largest square that can be made with the given matrix. Construct a new square matrix of this size using the elements from the original matrix in their original order. Parameters: matrix (list of lists of int) Return value: A new matrix (list of lists of int) Examples: ls = [[1,2,3,4],[5,6,7,8],[9,10,11,12]] new_ls = squarify(ls) print(new_ls) # prints [[1, 2, 3], [5, 6, 7], [9, 10, 11]]

apply(mask, matrix) [25pts]

Description: Given a matrix, apply the mask. The matrix is some MxN list of list of ints, and the mask is exactly a 2x2 list of lists of ints. Imagine you overlay the mask on top of the matrix, starting from the top left corner. There will be 4 places that overlap. Add each pair of numbers that are overlapped, and update the original matrix with this new value. Shift the mask down the row of the matrix to the next 2x2 that hasn't been updated already, and continue this process. Keep doing this down the columns as well. If you are on an edge and only a piece of the mask overlaps, you can ignore the other numbers and only update the overlapping portion. Parameters: matrix (MxN list of list of ints) and mask (2x2 list of list of ints) Return value: Nothing is returned. The updating occurs in-place, i.e. you modify matrix itself Examples: ls = [[1,2],[3,4]] apply([[1,1],[1,1]], ls) # nothing is returned! print(ls) # prints [[2, 3], [4, 5]] ls = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] apply([[1,1],[1,1]], ls) # nothing is returned! print(ls) # prints [[2, 3, 4], [5, 6, 7], [8, 9, 10]] ls = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]] apply([[1,0],[0,1]], ls) # nothing is returned! print(ls) # prints [[2, 2, 4], [4, 6, 6], [8, 8, 10], [10, 12, 12]]

In: Computer Science