Questions
Consider the following class definition:                   public class Parent {               private

Consider the following class definition:

                  public class Parent {

              private int varA;

              protected double varB;

              public Parent(int a, double b){

varA = a;

varB = b;

              }

              public int sum( ){

                   return varA + varB;

              }

public String toString( ){

                   return "" + varA + "   " + varB;

              }

        }

Consider that you want to extend Parent to Child. Child will have a third int instance data varC.

  1. Write the parameterized constructor definition for Child;
  2. Write the code to override the sum() method to now add all three values and return the sum;
  3. Write the code to define a method average() to calculate and return the average of varB and varC.
  4. Write the code to override the toString() method for Child.

Using the class definitions for Parent and Child from Question 2, write a Java application that will represent a family of 4 members.

  1. Declare a Parent array of size 4 called family.
  2. Instantiate two objects of type Parent using the parameterized constructor and assign each to the first two elements of family. Use values retrieved from the user as the parameter values.
  3. Instantiate two objects of type Child using the parameterized constructor and assign each to the last two elements of family. Use values retrieved from the user as the parameter values.
  4. Invoke the average() method for the two Child objects and display the result.
  5. Write a loop to display the member values of each object in family using the toString() method.

In: Computer Science

Activity Statement-  The Payroll department at xyz company would like you to develop a computer program that...

Activity Statement-  The Payroll department at xyz company would like you to develop a computer program that will determine the net pay of an employee. Design a Python program, which utilizes modules, that asks the user to enter the Name of employee, the total number of hours worked by the employee, and the hourly pay rate of the employee. The program will determine the Employee Gross Pay, the Paid Federal Taxes ( 30% of the Employee Gross Pay ), the Paid State Taxes ( 10% of the Employee Gross Pay ), and the Employee Net Pay ( Gross Pay - Federal Taxes - State Taxes ). In addition, the program will display the following items:

  • Employee Name
  • Employee Total Hours Worked
  • Employee Hourly Pay Rate
  • Employee Paid Federal Taxes
  • Employee Paid State Taxes
  • Employee Net Pay

Activity Instructions-

  1. You have only one attempt to submit. Therefore, be sure that you are submitting and uploading the correct solution. If you submit the wrong version, you will not be allowed to resubmit the solution. It is your responsibility to ensure that you did upload the correct solution!
  2. Launch the Python IDLE program.
  3. Develop the Python program using the following criteria:-
    1. The program consists of seven modules namely, main( ), getEmpInfo( ), computeGrossPay( ), computePaidFedTax( ), computePaidStateTax( ), computeNetPay( ), and printEmpInfo( )
    2. The main( ) module will call the rest of the modules.
    3. The purpose of the getEmpInfo( ) module is to allow the user to enter the employee name, the employee total working hours, and the employee hourly pay rate. The module getEmpInfo( ) is called by the main( ) module.
    4. The purpose of the computeGrossPay( ) module is to compute the employee gross pay. Use the formula Employee Gross Pay = Hours Worked times Hourly pay rate. Please discard any overtime. The computeGrossPay( ) module is called by the main( ) module.
    5. The purpose of the computePaidFedTax( ) module is to compute the amount of money which the employee should pay as a federal tax. Use the formula Employee Paid Federal Taxes = 30% of the Employee Gross Pay. The computePaidFedTax( ) module is called by the main( ) module.
    6. The purpose of the computePaidStateTax( ) module is to compute the amount of money which the employee should pay as a state tax. Use the formula Employee Paid State Taxes = 10% of the employee Gross Pay. The computePaidStateTax( ) module is called by the main( ) module.
    7. The purpose of the computeNetPay( ) module is to compute the employee net pay. Use the formula Employee Net Pay = Employee Gross pay - ( Paid Federal Tax + Paid State Tax ). The computeNetPay( ) module is called by the main( ) module.
    8. The printEmpInfo( ) module is called by the main( ) module. This module should display the following items:
      • Employee Name
      • Employee Total Working Hours
      • Employee Hourly Pay
      • Employee Paid Federal Taxes
      • Employee Paid State Taxes
      • Employee Net Pay

In: Computer Science

Please use the Java program below to test the following regex pattern (in the table) and...

Please use the Java program below to test the following regex pattern (in the table) and record the output, and explain how the output is generated.

import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegexTestBarness {
  
       public static void main(String[] arg) {
              Scanner input = new Scanner(System.in);
                while (true) {
                   System.out.println("Enter a regex pattern: ");
                   String regex = input.nextLine();
                  
                   // Create a regex pattern
                    Pattern pt = Pattern.compile(regex);
                  
                    System.out.println("Enter a input string to search: ");
                    String sr = input.nextLine();
                  
                    // Create a Matcher object
                    Matcher mt = pt.matcher(sr);

                    boolean found = false;
                    while (mt.find()) {
                        System.out.printf("I found the text \"%s\" starting at " +
                                          "index %d and ending at index %d.\n",
                                          mt.group(), mt.start(), mt.end());
                      
                        found = true;
                    }
                  
                    if(!found){
                        System.out.println("No match found.");
                    }
                }
       }
}



regex pattern
test string
output
explanation
[^abc]
abc
No match found.
Any character except a, b, or c
GAATTC
TGCAGAATTCGGG


\d
Homework01


\D
2010


\s
this is a regex


\s+
this is a   regex


[A-Z][A-Z]\s\d{5}
MD 20943


In: Computer Science

Match the source of a property with the form of normalization it is first required in...

Match the source of a property with the form of normalization it is first required in

      -       A.       B.       C.       D.       E.       F.       G.   

No multi-valued unrelated dependencies

      -       A.       B.       C.       D.       E.       F.       G.   

Columns have unique names

      -       A.       B.       C.       D.       E.       F.       G.   

No transitive dependencies

      -       A.       B.       C.       D.       E.       F.       G.   

No repeating groups

      -       A.       B.       C.       D.       E.       F.       G.   

Determinants are candidate keys

      -       A.       B.       C.       D.       E.       F.       G.   

Row and column order doesn't matter

      -       A.       B.       C.       D.       E.       F.       G.   

Column has single data type

      -       A.       B.       C.       D.       E.       F.       G.   

Single value in a column

      -       A.       B.       C.       D.       E.       F.       G.   

No partial dependencies

      -       A.       B.       C.       D.       E.       F.       G.   

Only constraints are about what is allowable in a field or on identification

      -       A.       B.       C.       D.       E.       F.       G.   

No related multi-value dependencies

      -       A.       B.       C.       D.       E.       F.       G.   

No duplicated rows

A.

5NF

B.

1NF

C.

4NF

D.

3NF

E.

DKNF

F.

BCNF

G.

2NF

In: Computer Science

Create a python script that reads in the contents of CityPop.csv and stores the data in...

Create a python script that reads in the contents of CityPop.csv and stores the data in a container. Task 2 will expect that your program can find cities by name within the container, so think about that as you set up your data container. Briefly describe how you store the data in comments. *It won't let me post the CSV file

In: Computer Science

hi, can you please create me a game that is not too hard but not too...

hi, can you please create me a game that is not too hard but not too easy using pygame in python. can you also explain the codes in each line ?

In: Computer Science

Question 1: Explain what I/O operation service provides. Describe why user application programs cannot provide these...

Question 1:

Explain what I/O operation service provides. Describe why user application programs cannot provide these services.

Question 2 :

Discuss the advantage and disadvantages of a layered approach.

In: Computer Science

please research software build and automation tools such as Maven, ANT, and Gradle. Answer the following...

please research software build and automation tools such as Maven, ANT, and Gradle. Answer the following in your post:

- What are used for and how are they used? - Compare and contrast each of the tools. - What are the benefits and best uses of each tool? Make sure you main post is 200 words.

In: Computer Science

Create the directory tree above in your /home/username folder using at most three (3) mkdir commands...

  1. Create the directory tree above in your /home/username folder using at most three (3) mkdir commands

  1. Use the ‘cat’ utility to create two text files called “nfile1” & “nfile2” in the “notes” directory. “nfile1” should contain the names of persons (at least 2 persons).

  1. Use the vi editor to create a simple text file, then save & quit. Briefly explain the various modes of vi and show how to delete a character, a word and a line

  1. Use the ‘tar’ utility to create an archive file of the ‘labs’ directory. Name your archive file labs.tar. Show how you can retrieve the contents from the labs.tar file.

  1. Move the file “nfile2” into the “unix” directory.

  1. Copy the file “nfile1” into the “java” directory.

  1. Show how you would create the files “test1”, “test2”, & “test3” in the “test” directory to ensure that they have the same file creation date/time.

In: Computer Science

Consider the following class definition:                   public class Parent {               private

Consider the following class definition:

                  public class Parent {

              private int varA;

              protected double varB;

              public Parent(int a, double b){

varA = a;

varB = b;

              }

              public int sum( ){

                   return varA + varB;

              }

public String toString( ){

                   return "" + varA + "   " + varB;

              }

        }

Consider that you want to extend Parent to Child. Child will have a third int instance data varC.

  1. Write the parameterized constructor definition for Child;
  2. Write the code to override the sum() method to now add all three values and return the sum;
  3. Write the code to define a method average() to calculate and return the average of varB and varC.
  4. Write the code to override the toString() method for Child.

In: Computer Science

In C++, write a program that will read up to 10 letters (characters) into an array...

In C++, write a program that will read up to 10 letters (characters) into an array and write the letters back to the screen in the reverse order. The program should prompt the user to input all values and can determine whether the input has ended by a punctuation mark such as ‘.’ (make sure that you’ll include meaningful and intuitive messages to the user).

For example, if the input is abcde, the output should be edcba. Include appropriate messaging (UI) to the user.

In: Computer Science

In JAVA Create a simple guessing game, similar to Hangman, in which the user guesses letters...

In JAVA

Create a simple guessing game, similar to Hangman, in which the user guesses letters and then attempts to guess a partially hidden phrase. Display a phrase in which some of the letters are replaced by asterisks: for example, G* T*** (for Go Team). Each time the user guesses a letter, either place the letter in the correct spot (or spots) in the phrase and display it again or tell the user the guessed letter is not in the phrase. Display a congratulatory message when the entire correct phrase has been deduced. Add to this the ability for the user to guess the entire phrase. Save the game as SecretPhrase.java.

Add to this an array of 10 phrases to choose from. Generate a random number to use to select one of the phrases from your array.

Also, add a second array to the the alphabet. As the user guesses a letter mark this letter in the alphabet array as used. When the user attempts to use a letter that was already used, tell them that letter was already user to please guess another letter.

Make the game loop so after a round the user can choose to play again and a different phrase will be chosen.

In: Computer Science

When is an ECPA relevant? Computer forensics

When is an ECPA relevant? Computer forensics

In: Computer Science

Describe a hypothetical scenario where someone would act in ways that are not legal, but it...

Describe a hypothetical scenario where someone would act in ways that are not legal, but it is ethical.

Describe a hypothetical scenario where someone would act in ways that are legal, but not ethical.

(150 Words for each case)

In: Computer Science

Design an O(n log n) algorithm that takes two arrays A and B (not necessarily sorted)...

Design an O(n log n) algorithm that takes two arrays A and B (not necessarily sorted) of size n of real numbers and a value v. The algorithm returns i and j if there exist i and j such that A[i] + B[j] = v and no otherwise. Describe your algorithm in English and give its time analysis.

In: Computer Science