Questions
Take the pseudocode that you developed in your previous assignment - and convert it into a...

Take the pseudocode that you developed in your previous assignment - and convert it into a working program. Or if you think of a better way of creating a working program – such as what we discuss in class.
The task was: Write the pseudocode for helping a cashier give you the correct change. Assume that a person brings hundreds to pennies to you and wishes to the receive quarters, dimes, and nickels back. There is a single input of the number of pennies given to the cashier. There will be several outputs: the number of five dollar bills, one dollar bills, quarters, dimes, nickels, and remaining pennies to be returned.
For the input, you will ask the user to enter the number of pennies (as an integer value) that he/she has. The output will be the Number of Five Dollar Bills, Number of One Dollar Bills, Quarters, Number of Dimes, Number of Nickels, and Number of Pennies. Each of the outputs should be integer values as well.
Provide me with just the source code for this task.
Sample Input:
Enter the number of pennies:
136
Sample Output:
Your change is:
Five Dollar Bills: 0
One Dollar Bills: 1
Quarters: 1
Dimes: 1
Nickels: 0
Pennies: 1

In: Computer Science

I need to update this java program to take input about each employee from a file...

I need to update this java program to take input about each employee from a file and write their information and salary/pay information to a file. use input file

payroll.txt

import java.util.Scanner;
public class SalaryCalcLoop
{
double Rpay = 0, Opay = 0;
void calPay(double hours, double rate) {
if (hours <= 40)
{
Rpay = hours * rate;
Opay = 0;
}
else
{
double Rhr, Ohr;
Rhr = 40;
Ohr = hours - Rhr;
Rpay = Rhr * rate;
Opay = Ohr * (1.5 * rate);
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String name;
int shift = 0;
Double rate, hours;
System.out.println("Pay Calculator");
String ch = "";
do
{
System.out.println("Enter Your Name");
name = sc.next();
System.out.println("Enter Your Shift, Enter 0 for Day, Enterv1 for Night");
System.out.println("0=Day, 1= Night");
shift=sc.nextInt();
System.out.println("Enter Number of Hours Worked");
hours = sc.nextDouble();
System.out.println("Enter Hourly Pay");
rate = sc.nextDouble();
SalaryCalc c = new SalaryCalc();
c.calPay(hours, rate);
Double Tpay = c.Rpay + c.Opay;
System.out.println();
System.out.println("Calculate Pay");
System.out.println("Employee Name: " + name);
System.out.println("Employee Regular Pay: " + c.Rpay);
System.out.println("Employee Overtime Pay: " + c.Opay);
System.out.println("Employee Total Pay: " + Tpay);
if (shift == 0)
{
System.out.println("Employee PayPeriod is Friday");
}
else
{
System.out.println("Employee PayPeriod is Saturday");
}
System.out.println("Press Y to continue. Press any other key to exit ");
ch=sc.next();
}
while(ch.equalsIgnoreCase("y"));
}
}

Saturday"); } System.out.println("Press Y to continue. Press any other key to exit "); ch=sc.next(); } while(ch.equalsIgnoreCase("y")); } }

Payroll.txt

Kevin

Yang

60

20

Trey

Adams

30

15

Rick

Johnson

45

10

Cynthia

Wheeler

55

11.50

Sarah

Davis

24

10

Muhammad

Rabish

66

12

Dale

Allen

11

18

Andrew

Jimenez

80

15

In: Computer Science

C++: FramedI is an interface and appears as: class FramedI { public: virtual string getText()=0; virtual...

C++: FramedI is an interface and appears as:
class FramedI { public: virtual string getText()=0; virtual char getFrameChar() =0; };

You must implement the interface and call the class FramedText. It must implement the FramedI interface. Any attributes used in the FramedText class MUST be private.

Create a function called void showFramedText(ostream&, FramedI&);

If the text to display is "Here's my text here" and the framing character is '*', the function must output
*********************** * Here's my text here * ***********************

The methods getText() would return "Here's my text here" and getFrameChar() would return '*'.

The showFramedText() function needs no more information to do it's work and can be written BEFORE implementing FramedText class.

Text must align perfectly around the text as shown. Make sure a newline is output after the last frame character. There must be a space between the leftmost frame character and the start of the text. Also, there must be a space at the end of the text before the rightmost character. See the use of FramedText in the template for clues on what constructor must be used. You must have only 1 constructor. Assume the text and the frame will never be too big across the screen, that is, the text will always be limited to say 30 characters.

#include<iostream>
#include<string>

using namespace std;


class FramedI
{
public:
virtual string getText()=0;
virtual char getFrameChar() =0;

};


void showFramedText(ostream& os, FramedI& fi)
{
//Write the function implementation here.
}

//Implement the FramedI interface here
//Your FramedText class must only have 1 constructor

int main()
{
FramedText frame1("MOVIE PREMIERE TONIGHT", '*');
FramedI *frame2 = new FramedText("W A R N I N G!", '#');

FramedI *frames[4];

//Properly assign frames[0] and [1] to frame1 and frame2
//Input from the user names of 2 classmates.
//Dynamically create instances who's values will be assigned to index 2 and 3 in the frames array.

//iterate the frames array and call showFramedText() function for each element.

//You may assume you know there's 4 elements in the frames array.

//As an example, if the user entered John Ceeplus for the first classmate's name, the third iteration should output:
/*
++++++++++++++++
+ John Ceeplus +
++++++++++++++++
*/
//Reminder that the showFramedText() function needs to do the output.

return 0;
}

In: Computer Science

Create a console app with C# that uses a while loop to calculate the average of...

Create a console app with C# that uses a while loop to calculate the average of 3 test scores.

Input integers, but use the appropriate average data type.

Generally, you use a while to do something while a condition is true. You can use a while loop to execute a certain number of times. *While* this is not the best use of the while loop and another loop is generally more appropriate, it follows the pattern below

set a counter to 0 or 1
set a sum variable to 0
set a total variable to 3 
while the counter is less the total (or less than or equal to, depending on if you started at 0 or 1)
{

write message asking for input
   read input
   parse to a number
   increment counter
}


Calculate average
print average with 2 decimal points precision*

In: Computer Science

Research Amazon EC2, Google App Engine, and Microsoft Azure. Write a detailed comparison. Focus on the...

Research Amazon EC2, Google App Engine, and Microsoft Azure.

Write a detailed comparison. Focus on the following 9 comparative points:

  1. Service models offered (IaaS, PaaS ,SaaS etc)
  2. VM instance types offered (such as micro, small, medium etc) along with their Number of vCPUs and memory sizes offered
  3. Different types of storages
  4. Development environment offered
  5. Security features
  6. Scalability, reliability and fault tolerance
  7. Pricing comparison for equivalent/similar services
  8. User friendliness (Interface, support etc)
  9. Special Feature (i.e., not available in other platform)

In: Computer Science

Write a C program that creates a structure and displays its content. • Create a struct...

Write a C program that creates a structure and displays its content. • Create a struct that will be used to hold a student's name, age, and year in school (Freshman, Sophomore, Junior, or Senior) • Within function main, dynamically allocate space to hold the structure and assign a pointer to point to the memory space allocated • Read in (from the keyboard) the student's name, age, and year in school • Create a separate function with the prototype: void display (struct student *) that can be used to display the contents of a single structure • Call this function twice - once for the original contents of the structure and again when the structure has been modified (Display year in school as indicated above, not 1, 2, 3, 4) • Increase the student's age by one and upgrade their year in school one level (unless they are already a Senior) • Free up the memory space before exiting

In: Computer Science

Exercise 5 (1 pt for each correct answer) For each of the following statements indicate whether...

Exercise 5 (1 pt for each correct answer)

For each of the following statements indicate whether it is true, false, or unknown.

  1. The SAT problem is in P.
  2. The SAT problem is in NP.
  3. The SAT problem is in EXP.

Bonus exercise (2 pts)

Show that if P=NP then there is a polynomial-time algorithm for the following search problem: given a graph, find its largest clique.

In: Computer Science

A hospital has a large number of registered physicians. Attributes of PHYSICIAN include Physician ID (the...

A hospital has a large number of registered physicians. Attributes of PHYSICIAN include Physician ID (the identifier) and specialty. Patients are admitted to the hospital by physicians. Attributes of PATIENT include patient ID(identifier) and patient name. Any patient who is admitted must have exactly one admitting physician. A physician may optionally admit any number of patients. Once admitted, a given patient must be treated by at least one physician. A particular physician may treat any number of patients or none at all. Whenever a patient is treated by a physician, the hospital wishes to record the details of the treatment (Treatment Detail). Components of Treatment Detail include date, time, and results.

Part C - UML Diagramming:

Recall the EER diagram you made for Medical Solutions Hospital in Part A.  Use Draw.io or Visio to construct a UML diagram from your EER diagram. The UML diagram should have spaces for both fields/attributes and methods. Both Visio and Draw.io have built-in templates for UML diagramming. Be sure to add the multiplicities (like cardinalities).

Include:

  • A method to get treatment results for a specific date
  • A method to get a patient name
  • A method to set a patient name
  • A method to get a physician name given a particular specialty

What is possible to express with a UML diagram that is not possible to express with an EER diagram? Are there any limitations compared to an EER diagram?

In: Computer Science

Lab 3-5: Activity 5-5:  Using Condition Statements                                &nb

Lab 3-5:

Activity 5-5:  Using Condition Statements                                   10 minutes

Objective: Create a script with if, then, and else statements.

Description: In this activity, you create a shell script that tests whether a file the user specifies exists and uses output and error redirection to do some simple command validation.

NOTE:

If necessary, start a virtual machine in the server mode, and sign-on. This script will determine if a user has sudo permission and then as such can execute the find command and traverse the hierarchy without Permission denied errors.

Make a subdirectory in your home directory and call it scripts (for roots scripts).

  1. Using vim, create an empty file named scr5.
  2. Switch to extended mode and display the line numbers.
  3. Switch to insert mode, and then create a script that performs the following:
  4. Sets the environment for the script to bash
  5. Documents the following:This script will find a file and display its absolute path on the screen.
  6. Informs the user that this is a script that :
    1. This script is for the sudo users only!
    2. AND if the test for sudo access is successful.
  7. Test the users sign on to make sure they have sudo access.
  8. THEN:
  9. Clears the screen.
  10. Prompts the user for the file-name to be searched for
  11. Sets the reply in a meaningful variable.
  12. Uses the find command to find the file and redirects the output of the find command to a file and any errors to a separate error_file.
  13. Return to your scripts directory.
  14. Create an if-then-else construct that:
    1. Tests if the file exists and has data in it.
    2. If true, inform the user that the file was found AND Where the file is located.
    3. If false, inform the user that the file was not found AND to try again.
    4. Insures the user is placed in the scripts directory when the script ends

Exit insert mode and switch to extended mode.  Save your changes and exit the vimeditor.

Give the owner execute permission to run the script.  Run the script searching for a valid file, like bash.  

What command did you use to run the script?

Answer:____________________________

Explain how you would test the script to make sure it was working.

Answer:___________________________________________

In: Computer Science

Mac OS X Directory Structure Outline how to organize files and directories. Describe preferences for file...

Mac OS X Directory Structure

Outline how to organize files and directories. Describe preferences for file names and how the concepts of a hierarchical directory structure could improve existing method of storage. If useing an alternative method, justify its use and benefits over and above basic approaches.

In: Computer Science

Write a C program to control an autonomous robot. It runs on two wheels, each wheel...

Write a C program to control an autonomous robot. It runs on two wheels, each wheel connected to a DC motor. If both wheels run at the same speed, robot moves forward. If the right wheel runs slower, robot makes a right turn. There are two sensors mounted on the robot that can detect an obstacle, one in the front, one on the right.

Once the robot is turned on, it moves forward at 80% of the maximum possible speed. When an obstacle is detected in front, if there is nothing blocking on the right side; it slows down to 40% of maximum speed and then it makes a right turn. Unless there is an obstacle on the right side too, then the robot will stop.

You must use PWM to control the wheels. The sensor outputs are digital, the mbed board will detect low when no obstacle and will detect high, when there is an obstacle. This is pin connections for this robot.

Device LPC1768 mbed pin

Right wheel pin 21

Left wheel pin 22

Front sensor pin 10

Right sensor pin 11

Use a flowchart to show the algorithm of your program.

In: Computer Science

1. Starting with an empty tree, show each step in the construction of an AVL tree...

1. Starting with an empty tree, show each step in the construction of an AVL tree using the following input in the order given. For full credit, you must show the tree after each new input is added. 16, 7, 14, 18, 6, 17, 2, 5, 13, 22, 4 (6 pts.)

2. Show how the AVL tree in previous changes with the following operations. For full credit, you must show the tree after each iteration.

Remove: 17

Remove: 18

Remove: 22

In: Computer Science

One of your chapters this week is on recursion. Below are the three recursive algorithms laws:...

One of your chapters this week is on recursion. Below are the three recursive algorithms laws:

1. A recursive algorithm must have a base case.

2. A recursive algorithm must change its state and move toward the base case.

3. A recursive algorithm must call itself, recursively.

Do you have any examples of recursive algorithms used in the real-world?

Approximately 175 words in the answer.

In: Computer Science

ERD Lucid chart with Crow's foot notation for the following. include all entities, attributes, and correct...

ERD Lucid chart with Crow's foot notation for the following. include all entities, attributes, and correct carnality in relationships between entities. primary and foreign keys.

You have been asked to build a database for a sportswear company called Ath Fleet.

The company owner needs to keep track of the customers that buy their products, the employees that work at Ath Fleet, the vendors that provide them with products, and the products themselves.

Each vendor has contact with one employee representative and needs this support.

Employees in their first year usually don't have vendors to support, as they are learning the ropes, but as they work there longer and more vendors are reached, they may be assigned their only vendor.

The owner wants to track employee names and email addresses, as well as vendor names and locations.Vendors provide products to Ath Fleet, like shoes, apparel, and equipment.

Each product they sell comes from only one vendor. Some products are made in house, but if a vendor is in the system they must have provided a product.

The owner wants to track product names and each product's unique SKU.

Finally, customers purchase products from Ath Fleet and that transaction data needs to be recorded. Each product is often purchased by lots of customers, especially if it is popular.

Customers are only put in the system if they have made a purchase, but a product does not need to have been purchased to be stored.

The owner wants to keep track of customer names and email addresses.

In: Computer Science

CompSci 251: Intermediate Computer ProgrammingLab 3 – 2019 Introduction This lab will focus on creating a...

CompSci 251: Intermediate Computer ProgrammingLab 3 – 2019

Introduction

This lab will focus on creating a Movie class conforming to the diagram above. From this class Movie objects can be instantiated and used in a running program. I have provided a mostly completely driver, you will need to add a few lines of code where specified.

What you need to do

  •  Declare you instance variables at the top of the class.

  •  Write a specifying constructor. No default constructor is required.

  •  Write getName and setName. There are no restrictions on the setting the name.

  •  Write getMinutes and setMinutes. When setting minutes, it is not allowed to be negative.

  •  Write getTomatoScore and setTomatoScore. When setting tomato score, score is not allowed

    to be negative or over 100.

  •  Write isFresh. A score is considered fresh if it is 60 or above. It is rotten otherwise.

  •  Write display. Print out the name, the total minutes, and if the movie is “Fresh” or “Rotten”.

    Remember, you have method which tells you this now.

  •  The driver is mostly complete. I placed one TODO, add a new movie of your choice to the array

    that stores movies (called myCollection) in the driver.

Your output should match the output below plus the one movie you add to it. Pay attention to how objects are accessed in the driver. See your TA when your output is correct.

Output:
Here are all the movies in my collection of movies.

Movie: Batman The Dark Knight Length: 2hrs 32min.
Tomato Meter: Fresh

Movie: Avengers: Endgame Length: 3hrs 2min. Tomato Meter: Fresh

Movie: The GodFather Length: 2hrs 58min. Tomato Meter: Fresh

Movie: Suicide Squad Length: 2hrs 17min. Tomato Meter: Rotten

//The movie you add will print out here.

_______________________________________________ Here are the Fresh movies.

Batman The Dark Knight is fresh. Avengers: Endgame is fresh.
The GodFather is fresh.

Here are the Rotten movies. Suicide Squad is rotten.

//The movie you add will print out here, it’s score will determine if fresh or not.

_______________________________________________
The movie Harry Potter and the Prisoner of Azkaban was created.

Is Harry Potter and the Prisoner of Azkaban a long movie? Yes, it is a bit long.

Can I set the minutes of Harry Potter and the Prisoner of Azkaban to a negative number?
It did NOT work. Negative runtimes are not allowed.

Can I set tomato score of Harry Potter and the Prisoner of Azkaban to a negative number?
It did NOT work. Negative scores are not allowed.

Can I set tomato score of Harry Potter and the Prisoner of Azkaban to a number greater than 100?
It did NOT work. Still the best Harry Potter movie out all the movies though.

Given Driver

public class MovieDriver {

public static void main (String [] args){

Movie[] myCollection = new Movie[5];

myCollection[0] = new Movie("Batman The Dark Knight", 152, 94);

myCollection[1] = new Movie("Avengers: Endgame", 182, 94);

myCollection[2] = new Movie("The GodFather", 178, 98);

myCollection[3] = new Movie("Suicide Squad", 137, 27);

//TODO

//Initialize the variable below and add it to myCollection at index 4.

//You can pick any movie you wish.

Movie yourMovie;

System.out.println("Here are all the movies in my collection of movies.\n");

for(int i = 0; i < myCollection.length; i++) {

if(myCollection[i] != null) {

myCollection[i].display();

System.out.println();

}

}

System.out.println("_______________________________________________");

System.out.println("\nHere are the Fresh movies.\n");

for(int i = 0; i < myCollection.length; i++) {

if(myCollection[i] != null && myCollection[i].isFresh()) {

System.out.println(myCollection[i].getName() + " is fresh.");

}

}

System.out.println();

System.out.println("Here are the Rotten movies.\n");

for(Movie movieTmp: myCollection){

if (movieTmp != null && !movieTmp.isFresh())

System.out.println(movieTmp.getName() + " is rotten.");

}

System.out.println("_______________________________________________\n");

Movie harryPotter = new Movie("Harry Potter and the Prisoner of Azkaban", 144, 91);

System.out.println("The movie " + harryPotter.getName() + " was created.\n");

System.out.println("Is " + harryPotter.getName() + " a long movie?");

if(harryPotter.getMinutes() > 120) {

System.out.println("Yes, it is a bit long.\n");

} else {

System.out.println("Nope, that isn't too bad.\n");

}

System.out.println("Can I set the minutes of " + harryPotter.getName() + " to a negative number?");

harryPotter.setMinutes(-5);

if(harryPotter.getMinutes() == -5) {

System.out.println("It worked. The runtime is -5 minutes.\n");

} else {

System.out.println("It did NOT work. Negative runtimes are not allowed.\n");

}

System.out.println("Can I set tomato score of " + harryPotter.getName() + " to a negative number?");

harryPotter.setTomatoScore(-100);

if(harryPotter.getTomatoScore() == -100) {

System.out.println("It worked. The score is -100. This movie is terrible according to the site.\n");

} else {

System.out.println("It did NOT work. Negative scores are not allowed.\n");

}

System.out.println("Can I set tomato score of " + harryPotter.getName() + " to a number greater than 100?");

harryPotter.setTomatoScore(101);

if(harryPotter.getTomatoScore() == 101) {

System.out.println("It worked. The score is 101. Best Harry Potter movie ever!\n");

} else {

System.out.println("It did NOT work. Still the best Harry Potter movie out all the movies though.\n");

}

}

}

In: Computer Science