For a given CPU, the cycle latency for a set of operations are given as follows:
Addition: 4
Subtraction: 8
Multiplication: 64
Division: 80
If the clock of this CPU runs at 3GHz, find the following
How many operations of each of the list above can this CPU perform in 5 minutes?
If we have a set of operations that contains 10^9 of each operation in the list in part 1, compute the required time in seconds to execute the set. Please explain the formula used.
In: Computer Science
Please make your Task class serializable with a parameterized and copy constructor, then create a TaskListDemo with a main( ) method that creates 3 tasks and writes them to a binary file named "TaskList.dat". We will then add Java code that reads a binary file (of Task objects) into our program and displays each object to the console. More details to be provided in class.
Here is a sample transaction with the user (first time the code is run):
Previously saved Tasks from binary file:
[None, please enter new Tasks]
Please enter task name (or "quit" to exit): Ace CS 112 Final
Exam
Please enter due date (in form MM/DD/YYYY): 10/10/2019
Please enter deadline : 3:20 PM
Please enter priority : 1
After 1 Task has been saved (second time the code is run):
Previously saved Tasks from binary file:
Task [name=Ace CS 112 Midterm Exam, dueDate=10/10/2019,
deadline=3:20 PM, priority=High]
Please enter task name (or "quit" to exit): quit
I don't know how to print the priorities High, medium, and Low in the toString method to where it is stored in the binary file after the user types 1, 2, or 3. 1 for high, 2 for medium, and 3 for low.
import java.io.*;
import java.util.Scanner;
public class IC10_TaskList {
public static void main(String[] args) {
String name, dueDate, deadline;
int priority;
Scanner keyboard = new Scanner(System.in);
Task[] allTasks = new Task[10];
int count = 0;
File binaryFile = new File("Task.dat");
try {
System.out.println("\nPreviously saved tasks from the binary file:");
if (binaryFile.exists()) {
ObjectInputStream inFile = new ObjectInputStream(new FileInputStream(binaryFile));
allTasks = (Task[]) inFile.readObject();
inFile.close();
for(int i = 0; i < allTasks.length; i++){
if(allTasks[i] != null){
System.out.println(allTasks[i]);
count++;
}
else
break;
}
}
else
System.out.println("[None, Please enter new task data]");
}
catch(IOException e){
System.err.println("Cannot find Task.dat");
}
catch(ClassNotFoundException e){
System.err.println("Serial Task version does not match.");
}
do{
System.out.print("\nPlease enter task name(or \"quit\" to exit): ");
name = keyboard.nextLine();
if(name.equalsIgnoreCase("quit"))
break;
System.out.print("Please enter due date(in form MM/DD/YYYY): ");
dueDate = keyboard.nextLine();
System.out.print("Please enter deadline: ");
deadline = keyboard.nextLine();
System.out.print("Please enter priority: ");
priority = keyboard.nextInt();
allTasks[count++] = new Task(deadline, dueDate, name, priority);
keyboard.nextLine();
} while(!name.equalsIgnoreCase("quit"));
try{
ObjectOutputStream outFile = new ObjectOutputStream(new FileOutputStream(binaryFile));
outFile.writeObject(allTasks);
outFile.close();
}
catch(IOException e){
System.err.println("File Task.dat cannot be found and/or written.");
}
}
}
import java.io.Serializable;
import java.util.Objects;
public class Task implements Serializable {
public static final long serialVersionUID = 1;
private String mDeadline;
private String mDueDate;
private String mName;
private int mPriority, mChoice;
public Task(String deadline, String dueDate, String name, int priority) {
mDeadline = deadline;
mDueDate = dueDate;
mName = name;
mPriority = priority;
}
public String getDeadline() {
return mDeadline;
}
public void setDeadline(String deadline) {
mDeadline = deadline;
}
public String getDueDate() {
return mDueDate;
}
public void setDueDate(String dueDate) {
mDueDate = dueDate;
}
public String getName() {
return mName;
}
public void setName(String name) {
mName = name;
}
public int getPriority() {
return mPriority;
}
public void setPriority(int priority) {
mPriority = priority;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Task task = (Task) o;
return mPriority == task.mPriority &&
mDeadline.equals(task.mDeadline) &&
mDueDate.equals(task.mDueDate) &&
mName.equals(task.mName);
}
@Override
public int hashCode() {
return Objects.hash(mDeadline, mDueDate, mName, mPriority);
}
@Override
public String toString() {
return "Task[" +
"Name = " + mName +
", Due Date = " + mDueDate +
", Deadline = " + mDeadline +
", Priority = " + mPriority +
"]";
}
}In: Computer Science
You will create a program that will follow the queuing theory of the Barbershop Problem. You will initially create a flow chart for the assignment to be uploaded to the Queuing Theory Flowchart assignment drop box. In this you will use queues and random number generators to complete this project. You will create three queues
You will create a container for the barbers chairs (list) . The wait times for the barbers will be random. Barber one will be the fastest and barber three will be the slowest. Randomize the wait times accordingly.
The cashier wait times will also vary randomly.
Barber wait times.
Cashier wait time
In: Computer Science
How has bribery been changed since it has become a statutory crime?
In: Computer Science
JAVA CODE
Give the definition of a static method called showArray that has an array of base type char as a single parameter and that writes to the screen each character in the array on a separate line. It then writes the same array characters in reverse order. This method returns a character array that holds these two lines of characters in the order that you printed them.
In: Computer Science
3) Please answer full question thoroughly (A- J) showing detailed work. Double check answer and work to ensure it is correct for thumbs up.
Boolean Functions, Truth Tables, Logic Minimization, Two-Level Forms Consider a boolean function f (a, b, c, d). Suppose that the function is 1 if
• There is a single 1 among the inputs, or
• There is a single 0 among the inputs, or
• There are exactly two 1’s among the inputs
and it is 0 otherwise.
(a) Write down a truth table for the function
(b) Using a Karnaugh map, provide a minimal sum-of-products (AND-OR) expres- sion.
(c) Using a Karnaugh map, provide a minimal product-of-sums (OR-AND) expres- sion.
(d) Provide a minimal NAND-NAND expression
(e) Provide a minimal OR-NAND expression (f) Provide a minimal NOR-OR expression
(g) Provide a minimal NOR-NOR expression (h) Provide a minimal AND-NOR expression
(i) Provide a minimal NAND-AND expression
(j) Provide a AND-XOR expression (with no negations)
In: Computer Science
The data warehouse is one of the most important business intelligence tools a business needs to have. It turns the massive amount of data generated from multiple sources into a format that is easy to understand.
Discuss the data warehouse concept?
In: Computer Science
JAVA CODE
Using the PurchaseDemo program and output from the previous problem as your guide, write a program that uses the Purchase class to set the following prices, and buy the number of items as indicated. Calculate the subtotals and total bill called total. Using the writeOutput() method display the subtotals as they are generated as in the PurchaseDemo program. Then print the total bill at the end. You may use integer, double, and String variables as needed but you may use only one object of the Purchase class and a for loop.
(Use the readInput() method for the following input data, you may assume the prompts and Scanner for the readInput() method takes place but you need not include either in your program output. )
Oranges: 10 for 2.99 buy 2 dozen oranges
Eggs; 12 for 1.69 buy 3 dozen eggs
Apples: 3 for 1.00 buy 20 apples
Watermelons: 4.39 each buy 2 watermelons
Bagels; 6 for 3.50 buy 1 dozen bagels
public class PurchaseDemo
{
public static void main(String[] args)
{
Purchase oneSale = new Purchase();
oneSale.readInput();
oneSale.writeOutput();
System.out.println("Cost each $" + oneSale.getUnitCost());
System.out.println("Total cost $" + oneSale.getTotalCost());
}
}
import java.util.Scanner;
/**
Class for the purchase of one kind of item, such as 3
oranges.
Prices are set supermarket style, such as 5 for $1.25.
*/
public class Purchase
{
private String name;
private int groupCount; //Part of a price, like the 2 in //2 for
$1.99.
private double groupPrice; //Part of a price, like the $1.99
// in 2 for $1.99.
private int numberBought; //Number of items bought.
public void setName(String newName)
{
name = newName;
}
/**
Sets price to count pieces for $costForCount.
For example, 2 for $1.99.
*/
public void setPrice(int count, double costForCount)
{
if ((count <= 0) || (costForCount <= 0))
{
System.out.println("Error: Bad parameter in " +
"setPrice.");
System.exit(0);
}
else
{
groupCount = count;
groupPrice = costForCount;
}
}
public void setNumberBought(int number)
{
if (number <= 0)
{
System.out.println("Error: Bad parameter in " +
"setNumberBought.");
System.exit(0);
}
else
numberBought = number;
}
/**
Reads from keyboard the price and number of a purchase.
*/
public void readInput()
{
Scanner keyboard = new Scanner(System.in);
System.out.println("Enter name of item you are purchasing:");
name = keyboard.nextLine();
System.out.println("Enter price of item as two numbers.");
System.out.println("For example, 3 for $2.99 is entered as");
System.out.println("3 2.99");
System.out.println("Enter price of item as two numbers, " +
"now:");
groupCount = keyboard.nextInt();
groupPrice = keyboard.nextDouble();
while ((groupCount <= 0) || (groupPrice <= 0))
{ //Try again:
System.out.println("Both numbers must " +
"be positive. Try again.");
System.out.println("Enter price of " +
"item as two numbers.");
System.out.println("For example, 3 for " +
"$2.99 is entered as");
System.out.println("3 2.99");
System.out.println(
"Enter price of item as two numbers, now:");
groupCount = keyboard.nextInt();
groupPrice = keyboard.nextDouble();
}
System.out.println("Enter number of items purchased:");
numberBought = keyboard.nextInt();
while (numberBought <= 0)
{ //Try again:
System.out.println("Number must be positive. " +
"Try again.");
System.out.println("Enter number of items purchased:");
numberBought = keyboard.nextInt();
}
}
/**
Displays price and number being purchased.
*/
public void writeOutput()
{
System.out.println(numberBought + " " + name);
System.out.println("at " + groupCount +
" for $" + groupPrice);
}
public String getName()
{
return name;
}
public double getTotalCost()
{
return (groupPrice / groupCount) * numberBought;
}
public double getUnitCost()
{
return groupPrice / groupCount;
}
public int getNumberBought()
{
return numberBought;
}
}
In: Computer Science
Respond to the following in a minimum of 175 words:
Organizations need to know the value of their data to find the best way to protect it. The data must be categorized according to the organization’s level of concern for confidentiality, integrity, and availability. The potential impact on assets and operations should be known in case data, systems, and/or networks are compromised (through unauthorized access, use, disclosure, disruption, modification, or destruction).
Choose an organization from the Health Care, Finance, or Education sector to study throughout this course.
Based on your chosen organization, ensure you:
In: Computer Science
6. Write a Python function that checks whether a passed string is palindrome or
not. Note:-A palindrome is a word, phrase, or sequence that reads the same backward
as forward
. Some examples you may try: “madam”
redder
“race car”
Eva, Can I Stab Bats In A Cave?
If the argument passed is not a string,
invoke an exception or an assertion
and state in a comment which one you have chosen and why.
In: Computer Science
Research the common client hardware and software that is used by end users to access virtual desktop environments. Explore each of the client connection methods in detail list both pros and cons for each connection method or device. You need to have a minimum of 3 different devices or connection types discussed in your paper.
In: Computer Science
In C++, Write a function to reverse the nodes in a linked list. You should not create new nodes when you reverse the the linked list.
The function prototype: void reverse(Node*& head);
Use the following Node definition:
struct Node
{
int data;
Node *next;
}
In: Computer Science
Please type answer for i can copy it. Thank you very much.
-Question
Respond to the following in a minimum of 175 words:
Discuss the following:
In: Computer Science
In: Computer Science
A regional transit company wants to determine whether there is a relationship between the age of a bus and the annual maintenance cost. A sample of 10 buses resulted in the following data: spss
|
Age of Bus (years) |
Annual Maintenance Cost ($) |
|
1 |
350 |
|
2 |
370 |
|
2 |
480 |
|
2 |
520 |
|
2 |
590 |
|
3 |
550 |
|
4 |
750 |
|
4 |
800 |
|
5 |
790 |
|
5 |
950 |
Instructions:
In: Computer Science