Questions
Design two sub- classes of Employee...SalariedEmployee and HourlyEmployee. A salaried employee has an annual salary attribute....

Design two sub- classes of Employee...SalariedEmployee and HourlyEmployee. A salaried employee has an annual salary attribute. An hourly employee has an hourly pay rate attribute, an hours worked attribute, and an earnings attribute. An hourly employee that works more than 40 hours gets paid at 1.5 times their hourly pay rate. You will decide how to implement constructors, getters, setters, and any other methods that might be necessary.

1. (20 points) Draw a UML diagram for the classes.

2. (80 points) Implement the classes, and write a test program that creates a salaried employee and two hourly employees. One of the hourly employees should have hours worked set to less than 40 and one should have hours worked set to more than 40.

The test program should display all attributes for the three employees. To keep things simple, the employee classes don’t need to do any editing.

I really need help with the first part of this question regarding the UML.

In: Computer Science

The second assignment involves writing a Python program to compute the price of a theater ticket....

The second assignment involves writing a Python program to compute the price of a theater ticket. Your program should prompt the user for the patron's age and whether the movie is 3D. Children and seniors should receive a discounted price. There should be a surcharge for movies that are 3D. You should decide on the age cutoffs for children and seniors and the prices for the three different age groups. You should also decide on the amount of the surcharge for 3D movies. Your program should output the ticket price for the movie ticket based on the age entered and whether the movie is in 3D.

Your program should include the pseudocode used for your design in the comments. Document the values you chose for the age cutoffs for children and seniors, the prices for the three different age groups and the surcharge for 3D movies in your comments as well.

You are to submit your Python program as a text file (.txt) file. In addition, you are also to submit a test report in a Word document or a .pdf file. 15% of your grade will be based on whether the comments in your program include the pseudocode and define the values of your constants, 70% on whether your program executes correctly on all test cases and 15% on the completeness of your test report.

In: Computer Science

Im trying to create a book list. I started off like this but idk how to...

Im trying to create a book list. I started off like this but idk how to continue?

public static int [] BookList (String title, String author, int price, int copies, String category) {

}

I don't know what to do next in order to list a set of (lets say 5 ) books and how to call it in the main (public static void main(String[] args))method

In: Computer Science

Use a while(true) loop to ask the user the following 2 values “Enter a rate r...

Use a while(true) loop to ask the user the following 2 values “Enter a rate r =” “Enter a nonnegative integer (enter negative integer to quit):”
If the user enters a negative int for n, the while loop is broken via the brake statement. Otherwise,
in the remaining part of the while loop, use a for loop to compute the partial sum for the geometric
series, namely 1 + r + rˆ2 + rˆ3 + . . . +rˆn.
Use the iomanip library in order to print the sum with 50 decimal digits of precision.

Sample output:

Enter a rate r = 4
Enter a non-negative integer (enter negative integer to quit): 9
1 + 4^1 + 4^2 + 4^3 + 4^4 + 4^5 + 4^6 + 4^7 + 4^8 + 4^9 = 349525
Enter a rate r = 0
Enter a non-negative integer (enter negative integer to quit): 3
1 + 0^1 + 0^2 + 0^3 = 1
Enter a rate r = -4
Enter a non-negative integer (enter negative integer to quit): -2

C++

Will like if correct,thank you.

In: Computer Science

Exercises 4. Using the IDE make a new project/program by changing SmallIO.java so that integers instead...

Exercises

4. Using the IDE make a new project/program by changing SmallIO.java so that integers instead of Strings are entered by the user.

5. Change the program so that it only loops until the number -999 is entered by the user.

6. Modify the last program so that it (a) keeps and displays a running total and the average so far of the entered numbers (b) displays the largest and the smallest numbers so far of the entered numbers.

NOTE: PART 4 AND 5 HAS BEEN DONE. IN PART 6a TOTAL HAS BEEN DONE YOU HAVE TO CALCULATE AVERAGE AND DO PART B. BELOW IS THE PROGRAM CONTINUE DOING IT FROM WHERE I LEFT. THANKS

package tutorial1;

import java.util.Scanner;

/**
*
* @author ML
*/
public class Tutorial1 {


  
public static void main(String[] args) {
  
Scanner keyboard = new Scanner(System.in);
int a = 0; // initialise to empty string
int total = 0;
  
while (a != -999){
//an infinite loop, use Ctrl-C to quit
System.out.println("Enter a line:"); //prompt
a= keyboard.nextInt(); ///accepts an integer
System.out.println("Your number: " + a);
  
//method caLLS
total = totalaverage(a, total);
System.out.println("Your total is: " + total);
  
System.out.println(); // print a blank line
} //end of while
  
  
}//end of main
// keeps and displays a running total and the average so far of the entered numbers
public static int totalaverage(int a, int total)
{

return total + a ;

  
}
  
  
  
  
  
  
  
}

In: Computer Science

Compose a research report on Bar Codes vs. RFID. You work as an efficiency analyst at...

Compose a research report on Bar Codes vs. RFID. You work as an efficiency analyst at one of the largest retail companies in the world, with multiple stores in every state, as well as in many other countries. For the past 25 years, the company has used bar code readers at checkout counters that scan the bar code on products to determine from a database the price to charge customers and to keep a record of inventory. The company is considering replacing the bar codes and bar code readers with RFID. Analyze and discuss the impact such a change would have on the company, its suppliers, and its customers. Include in your discussion any security risks.


Find two examples of RFID readers and compare prices, user reviews, and features. Are handheld options for RFID readers available for store clerks to use on the store floor or for customer checkout? Compile your findings. List the advantages and disadvantages of implementing RFID. Include information about reliability and costs.

In: Computer Science

Your task is to create a book ordering form using VISUAL STUDIOS, with the code and...

Your task is to create a book ordering form using VISUAL STUDIOS, with the code and screenshots

1. Boxes for first name, last name, address.

2. Radio buttons to select: hard cover, soft cover, ebook.

3. Drop down list to select the book (make up three or four book names).

4. Radio buttons to select credit card (at least Visa, Master Card, American Express).

5. Box to enter credit card numbers.

6. The credit card box MUST verify that numbers are entered only. It will display error information and make the user enter the information agaion.

7. All items will be checked to make sure the user entered something, or selected something. If something is missing an error message must be displayed.

Once the user clicks the submit button, the following happens:

A total price is determined by looking at the book selected, and the type of book selected.

If the book is hardback, the price is $50, softback $40, ebook $30.

Add 10% sales tax.

Display the book name, book type, and total cost back to the user. Also thank them for the order.

Make everything user friendly by including labels, and text to explain what to do and what to enter into boxes.

In: Computer Science

Write a subroutine that will receive a char input value. This subroutine should then use a...

Write a subroutine that will receive a char input value. This subroutine should then use a switch statement to determine if the char is a vowel, consonant, digit, or other type of character.

Write the subroutine only,
This is in C++

In: Computer Science

Use a while(true) loop to ask the user the following 2 values “Enter a value x...

Use a while(true) loop to ask the user the following 2 values “Enter a value x “ “Enter a nonnegative integer n (enter negative integer to quit): “
If the user enters a negative int for n, the while loop is broken via the brake statement. Otherwise,
in the remaining part of the while loop, use a for loop to compute the partial sum for the Riemann
zeta series for the geometric series, namely 1 + 2ˆ-x + 3ˆ-x + . . . + nˆ-x.
Use the iomanip library in order to print the sum with 50 decimal digits of precision.
Use the cmath library in order to access the pow function. For example pow(3,-x) returns the value
of 3ˆ-x.

Sample output:
Enter a value x = 5
Enter a non-negative integer (enter negative integer to quit): 4
1 + 2^-5 + 3^-5 + 4^-5 = 1.0363417888374486519609263268648646771907806396484
Enter a value x = -5

Enter a non-negative integer (enter negative integer to quit): 4
1 + 2^5 + 3^5 + 4^5 = 1300
Enter a value x = 6
Enter a non-negative integer (enter negative integer to quit): -2

C++.will like if correct,thank you.

In: Computer Science

Define a java problem with user input, user output, Do While Statement and some mathematical computation....

Define a java problem with user input, user output, Do While Statement and some mathematical computation. Write the pseudocode, code and display output.

In: Computer Science

Neurons: Please construct a Neural Network for the following logic, NAND Truth table for NAND function...

  1. Neurons: Please construct a Neural Network for the following logic, NAND

Truth table for NAND function

i1

i2

output

0

0

1

0

1

1

1

0

1

1

1

0

In: Computer Science

1. WHEN I RUN THE CODE AT FIRST AND I SELECT THE RETURN OPTION, IT BREAKS....

1. WHEN I RUN THE CODE AT FIRST AND I SELECT THE RETURN OPTION, IT BREAKS. BUT WHEN I SELCT THE RETURN OPTION AFTER I BORROW A BOOK, IT WORKS

2. WHY IS MY ARRAYLIST NO SAVING? WHAT I MEAN IS THAT AFTER I BORROW A BOOK AND I END THE SYSTEM, WHEN I RESTART IT, THE BOOK I BORROWED IS STILL AVAILABLE

3.ALSO ANY IDEAS ON WHAT MY TEST CASES COULD BE?
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package librarysystem;
import java.util.ArrayList;
import java.util.Scanner;
/**
*
*/
public class Books {
ArrayList<String> availBooks = new ArrayList<>();
ArrayList<String> borrowedBooks = new ArrayList<>();
ArrayList<String> allBooks = new ArrayList<>();
Scanner input = new Scanner(System.in);
Books() {
}
public void availableBooks() {
availBooks.add("Chronicle of Narnia");
availBooks.add("Harry Potter");
availBooks.add("The fault in our stars");
availBooks.add("Wizard of Oz");
}
public void allBooks() {
allBooks.add("Chronicle of Narnia");
allBooks.add("Harry Potter");
allBooks.add("The fault in our stars");
allBooks.add("Wizard of Oz");
allBooks.add("James Bond");
allBooks.add("The Hobbit");
allBooks.add("Fellowship of the ring");
}
public void borrowedBooks() {
borrowedBooks.add("James Bond");
borrowedBooks.add("The Hobbit");
borrowedBooks.add("Fellowship of the ring");
}
public void begin() {
System.out.println(".............................");
System.out.println("What would you like to do today?");
System.out.println("1. Search for book"
+ "\n" + "2. Borrow book" + "\n" + "3. Return book"
+ "\n" + "4. Log out" + "\n pick 1,2,3 or 4");
int ans = input.nextInt();
input.nextLine();
if (ans == 1) {
searchBooks();
} else if (ans == 2) {
borrow();
} else if (ans == 3) {
returnBook();
} else if (ans == 4) {
System.out.println("Logging out...");
System.exit(0);
} else {
System.out.println("Pleasepick 1,2,3 or 4");
}
}
public void searchBooks() {
System.out.println("What is the name of the book youre looking for?");
String bookName = input.nextLine();
if (allBooks.contains(bookName) && borrowedBooks.contains(bookName)) {
System.out.println("Book found!: " + bookName);
System.out.println("Status: Unavailble for borrowing");
System.out.println("returning to main session ...");
begin();
} else if (allBooks.contains(bookName)
&& availBooks.contains(bookName)) {
System.out.println("Book found!: " + bookName);
System.out.println("Status: Available for borrowing");
System.out.println("Would you like to borrow" + bookName
+ "? yes or no");
String ans = input.nextLine();
if (ans.equalsIgnoreCase("yes")) {
borrow1(bookName);
} else if (ans.equalsIgnoreCase("no")) {
System.out.println("returning to main session ...");
begin();
} else {
System.out.println("returning to main session ...");
}
} else {
System.out.println("Sorry, we could not find " + bookName);
System.out.println("returning to main session ...");
begin();
}
}
public void borrow() {
System.out.println("What is the name of the book you"
+ " would like to borrow?");
String borrowName = input.nextLine();
if (allBooks.contains(borrowName)
&& borrowedBooks.contains(borrowName)) {
System.out.println("Book found!: " + borrowName);
System.out.println("Status: Unavailble for borrowing");
System.out.println("returning to main session ...");
begin();
} else if (allBooks.contains(borrowName)
&& availBooks.contains(borrowName)) {
System.out.println("Book found!: " + borrowName);
System.out.println("Status: Available for borrowing");
System.out.println("Would you like to borrow " + borrowName
+ "? yes or no");
String ans = input.nextLine();
if (ans.equalsIgnoreCase("Yes")) {
borrow1(borrowName);
} else if (ans.equalsIgnoreCase("No")) {
System.out.println("returning to main session ...");
begin();
} else {
System.out.println("returning to main session ...");
}
} else {
System.out.println("Sorry, we could not find " + borrowName);
System.out.println("returning to main session ...");
begin();
}
}
public void borrow1(String nameOfBook) {
System.out.println("Borrowing ...");
availBooks.remove(nameOfBook);
borrowedBooks.add(nameOfBook);
System.out.println("You have successfully borrowed " + nameOfBook);
System.out.println("returning to main session ...");
begin();
}
public void returnBook() {
System.out.println("What is the name of the book "
+ "you would like to return?");
String returnName = input.next();
if (allBooks.contains(returnName)) {
availBooks.add(returnName);
borrowedBooks.remove(returnName);
System.out.println("Returning ...");
System.out.println("Return successful!");
System.out.println("returning to main session ...");
begin();
} else {
System.out.println("This book does not belong to this Library");
System.out.println("returning to main session ...");
begin();
}
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package librarysystem;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.Arrays;
import java.util.List;
/**
*
*/
public class Users {
Books book = new Books();
ArrayList<String> rUsers = new ArrayList<>();
Scanner input = new Scanner(System.in);
Users() {
}
public void arrayList() {
rUsers.add("name1");
rUsers.add("name2");
}
public void createAccount() {
System.out.println("To register, please enter your Full name");
String fullname = input.nextLine();
rUsers.add(fullname);
System.out.println("You have succesfully registered!");
book.allBooks();
book.availableBooks();
book.borrowedBooks();
//CALL THE METHOD THAT STARTS THE OPTIONS
book.begin();
}
public void logIn() {
System.out.println("Please enter your name");
String name = input.nextLine();
if (rUsers.contains(name)) {
System.out.println("You are logged in!");
book.allBooks();
book.availableBooks();
book.borrowedBooks();
book.begin();
} else {
//run the loop that asks the questions
System.out.println("Invalid Login");
System.out.println("Please create account if you are not registered");
createAccount();
}
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package librarysystem;
import java.util.Scanner;
/**
*
*/
public class LibrarySystem {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Users users = new Users();
Scanner input = new Scanner(System.in);
System.out.println("WELCOME TO LIBRARY SYSTEM");
System.out.println("Are you a registered user? Yes or No");
//asking user if he or she is registered in order to get access into
//the system
String answer = input.nextLine();
// the answer the user types in
if (answer.equalsIgnoreCase("Yes")) {
//if the user is part of the system log in
users.arrayList();
users.logIn();
} else {
users.createAccount();
users.logIn();
}
}
}

In: Computer Science

JAVA Lab Assignment #13:  Looping Lab with both types of loops. This lab demonstrates the use of...

JAVA

Lab Assignment #13:  Looping Lab with both types of loops.

  • This lab demonstrates the use of the While Loop and the Do While Loop as error checking mechanisms.
  • You will be using each of these loops to solve the same problem.
  • Please put them both in the same program.
  • When you test the code, you will not see a difference in the way they execute - but there will be a difference in the logic when writing the code.
  • You will want to write a refined algorithm for both to see the logic differences.

Lab 13 Part a:

Using a While Loop, write the code that does the following:

  • Prompts the User for a score between 0 and 100 (inclusive).
  • Repeats the prompt until the User enters a valid number within the specified range.

Lab 13 Part b:

Using a Do While Loop, write the code that does the following:

  • Prompts the User for a score between 0 and 100 (inclusive).
  • Continues to prompt for scores until the User enters a valid number within the specified range.

Include the following in your programs:

  • A refined algorithm for each looping structure.
  • Internal documentation for your code.

NOTE 1:

  • DO NOT use the "return 0" code, end, break, or exit to force an exit from within your IF/ELSE structure.  Declare all variables within the data declaration section.
    • Let the program progress to the end of the main function.
    • The end of the main function is the only place that the “return 0” should be placed.
    • A SWITCH statement is the only place that the break command should be used.
  • DO NOT use the "continue" statement.

NOTE 2:

1. Declare all variables within the data declaration section of each class and method.  (-.1)
2   Do not get input on the same line as a variable declaration.  
(-.1)

3. Do not place an equation for computation on the same line as declaring a variable.  (-.1)
3. Do not place an equation for computation on the same line as an input statement.  (-.1)

In: Computer Science

Given a graph G = (V,E), the source-sink pair (s,t) and capacity of edges {C_e ≥...

Given a graph G = (V,E), the source-sink pair (s,t) and capacity of edges {C_e ≥ 0 | e ∈ E}, design a polynomial-time algorithm to find a set of edges S, such that for every edge e ∈ S, increasing C_e will lead to an increase of max-flow value between s and t. Show the correctness of your algorithm.

In: Computer Science

2. Discuss the business rules for locating and purchasing a book online. How does your system...

2. Discuss the business rules for locating and purchasing a book online. How does your system definition impact those rules. (33points)

In: Computer Science