Consider three different processors P1, P2 and P3 executing the same instruction set with clock rates and CPI given in the following table: Processor Clock Rate CPI P1 2 GHz 1.5 P2 1.5 GHz 1.0 P3 3 GHz 2.5 c) We are trying to reduce the execution time by 30% but this leads an increase of 20% in the CPI. What clock rate should we have to get this time reduction? b) If the processors each execute a program in 10 seconds, find the number of cycles and the number of instructions
In: Computer Science
Given the choice (complete freedom, monetary backing, etc.) what requirements gathering method would you tend to implement, and why?
In: Computer Science
how multiplication of two numbers (50 & 25) stored in RAM is carried out on the Cortex-M4 processor using the MUL instruction.
In: Computer Science
A. Create a Dollar currency class with two integer attributes and one string attribute, all of which are non-public. The int attributes will represent whole part (or currency note value) and fractional part (or currency coin value) such that 100 fractional parts equals 1 whole part. The string attribute will represent the currency name.
B. Create a CIS22C Dollar derived/inherited class with one additional non-public double attribute to represent the conversion factor from/to US Dollar.
C. In your two currency classes, add public methods for the following:
D. Create a Wallet class with one attribute - an array of two Dollar references / pointers and the following methods to demonstrate polymorphism of the currencies:
E. In your main:
Language C++
In: Computer Science
uppose the following scenarios to discuss the impact effecting on the degree of multiprogrammingand context switching time?
Scenario1:all the processes in the ready queue are classified as I/O bound –process.
Scenario 2:All the processes in the ready queue are classified as CPU bound –process.
Scenario 3:Most of the processes in the ready queue are classified asmix of I/O bound –processes and CPU-bound processes
In: Computer Science
class A
{
public:
//constructors //
other members private:
int a;
int b;
};
Give declatations of operator functions for each of the following ways to overload operator + You must state where the declatation goes, whether within the class in the public or private section or outside the class. The operator + may be overloaded. a) as friend function b) as member function c) as non-friend, non-member function
In: Computer Science
In order to achieve faster access to data, many I/O operations involve specific data structure class called "Buffer". Our goal in this question is to design a UML class diagram for a character buffer (an array of chars ) based on the following description. This particular buffer:
In: Computer Science
USING C++:
Consider the precedence levels of the relational, logical, and arithmetic operators of the PySub language to be as follows (NOTE: 5 has highest precedence and 0 lowest):
5 | *, /, % |
4 | +, - |
3 | <, <=, >, >=, !=, == |
2 | not |
1 | and |
0 | or |
1. Infix-Postfix Conversion and Evaluation with Logical and Relational operators – Convert the following infix expression to a postfix expression and evaluate the result (assume that true=1 and false=0). Provide both the postfix expression and the result.
In: Computer Science
Using SQL create a new database called school_app. Create a student table with fields id (auto increment), first_name, last_name. Create a course table with fields id (auto increment), course code (such as ITC or MTH), and course number (such as 100 or 295). Note that the relationship between student and course is many-to-many (n:m). Create a join table called student_course that implements the n:m relationship with fields id (auto increment), student_id, course_id, and grade (which has values 0, 1, 2, 3, or 4). Insert data into all the tables with at least 10 different students and at least 3 different courses (you must be one of the students). Make sure all the students are taking multiple courses and all courses have multiple students. Do not use the data from anyone else in this course. When finished, do a SELECT * for all three tables and copy/paste the results here:
If someone could help me with this, it would be greatly appreciated. Ill certainly give a thumbs up!
In: Computer Science
05 Prepare : Checkpoint A
Objective
This assignment will give you practice writing event
handling methods to advance a ship in two dimensional
space.
Overview
After completing (or while completing) the
preparation material for this week, complete the following
exercise.
For this exercise, you will create a class that models
a ship flying around in a 2-D plain (containing an x and y
coordinate). A game class is provided to you that will help you
call methods to advance and "draw" it.
Instructions
Write a class for a ship that has integer x and y
coordinates, and also stores the components of its velocity, dx and
dy. (Please note that will will have similar elements in our weekly
assignment, where we will break them into separate classes, but for
this assignment, you can store all four as member variables of your
ship class.
The ship should have two methods, one for advance, and
one for draw. The advance method should move the ship forward one
unit in time. This is accomplished by adding dx onto x, and dy onto
y. This draw method should output, "Drawing the ship at (x, y)"
where x and y represent the current location of the ship. The
__init__ method for the ship should initialize x, y, dx, and dy to
0.
For this assignment, the provided main function will
set the velocity of the ship when it is created, and the velocity
will remain constant for the rest of that run.
The following UML class diagram defines your ship
class:
Shipx : inty : intdx : intdy :
int__init__()advance()draw()
To go with your ship class, you will be provided with
a Game class and a main function. The Game class has a ship, and
two important functions, on_draw() and update(). In your the
on_draw function, you simply need to call the ship's draw function.
In the update function, you simply need to call the ship's advance
function. Nothing else in the Game class is required of
you.
In addition, nothing is required from you in the main
function. It can be left as provided. You can obtain the provided
code from: /home/cs241/check05a.py with the following
command:
cp /home/cs241/check05a.py .
Finally, for simplicity, for this assignment you may
include all of your classes in the same file if you would
like.
INSTRUCTIONS RECAP
Thus, in short, for this checkpoint, you need to do
the following.
Create a Ship class
Create an __init__ method that sets x, y, dx, and dy
to 0.
Create a draw method that prints the text, "Drawing
ship at (x, y)".
Create an advance method that adds dx to x, and dy to
y.
In the Game class on_draw method, call your ship's
draw method.
In the Game class update method, call your ship's
advance method.
Sample Output
The following is an example of output for this program:
Enter a random seed: cat Starting the ship with velocity (-1, 3)
Drawing ship at (-1, 3) Drawing ship at (-2, 6) Drawing ship at
(-3, 9) Drawing ship at (-4, 12) Drawing ship at (-5, 15) Drawing
ship at (-6, 18) Drawing ship at (-7, 21) Drawing ship at (-8, 24)
Drawing ship at (-9, 27) Drawing ship at (-10, 30) Drawing ship at
(-11, 33) Drawing ship at (-12, 36) Drawing ship at (-13, 39)
Drawing ship at (-14, 42) Drawing ship at (-15, 45) Drawing ship at
(-16, 48) Drawing ship at (-17, 51) Drawing ship at (-18, 54)
Drawing ship at (-19, 57) Drawing ship at (-20, 60)
Automatic Grading Script (TestBed)
This assignment is pass/fail. In order to receive
credit, it must pass the auto-grading test script (TestBed). You
can run this script as many times as you like while you are working
on the assignment. The same test script will be run by the
instructor for credit, so you should not be surprised at the
result.
In addition, because the point of this exercise is to
help you practice the use of classes. You must use classes
to receive credit for this assignment.
In: Computer Science
Write a program which:
Prompts the user for a positive integer >= 0
Validates the user input to ensure it is a positive integer >= 0
Allocate (dynamically) an array big enough for the data.
Load the array with random numbers ranging in value from1 to 100
Display the elements of the array (unsorted)
Display the elements of the array (sorted)
Display the average
Display the median
Display the mode, if none, display appropriate message
RESTRICTIONS
No global variables
No infinite loops examples.
for(;;)
while(1)
while(true)
do{//code}while(1);
No break statements to exit loops
program must contains all the functions below
#include
#include /* srand, rand */
#include /* time */
using namespace std;
Must use all the functions below
// Function prototypes
double median(int *, int);
int mode(int *, int);
int *makeArray(int);
void loadNumberData(int *, int);
void selectionSort(int [], int);
double average(int *, int);
void displayArray(int * numberData, int qtyOfRandomNumbers);
void validateInt(string userIn, int& userInput);
int main()
{
}
//function definitions
//*************************************************
//function displayArray
//this function displays the elements of the array
//use pointer arithmetic to step through the array
//*************************************************
//function validateInt ensures that the user input
//deny non numeric input (ex. space, x, !,@,^)
//is an integer >= 0
//*************************************************
// Function makeArray *
// This function dynamically allocates an array of*
// ints and returns a pointer to it. The parameter*
// size is the number of elements to allocate. *
//*************************************************
//*************************************************
// Function loadNumberData *
// This function loads the array with random numbers*
//ranging in value from 1 to 100
//use pointer arithmetic to step through the array *
//*************************************************
//*************************************************
// Function selectionSort *
// This function performs the selection sort *
// algorithm on array, sorting it into ascending *
// order. The parameter size holds the number of *
// elements in the array. *
//*************************************************
//**************************************************
// Function median *
// This function displays the median of the values *
// in the array pointed to by the parameter arr. *
// The num parameter holds the number of elements *
// in the array. *
//**************************************************
//*********************************************************
// Function mode *
// This function returns the mode of the array pointed to *
// by arr. The mode is the value that appears most often. *
// The parameter num holds the number of elements in the *
// array. If no element appears more than once, the *
// function returns -1. *
//*********************************************************
//**************************************************
// Function average *
// This function calculates and returns the average*
// of the values in the array arr. num is the *
// number of elements in the array. *
//**************************************************
In: Computer Science
create class diagram of the following case.
Case: Once a month, the person in charge of the human
resources area of the organization prepares
the payroll to be paid. Once the calculation is made, the manager
accesses and authorizes the payment of the
information generated for payment, which is updated in the database
to be sent to the
Bank.
The person in charge of the payroll, in turn, is in charge of
making the entry and / or withdrawal of the
collaborators of the organization.
Employees can access the intranet to consult the remuneration they
will receive.
Regarding the system, it is required to develop the modeling of
objects and interfaces with the use
of object structures and their relationships for an organization
that has as collaborators
to the following categories:
- Administrative
- Sellers
- Production workers
Administrative staff have a fixed monthly salary
Production workers must work three different shifts: Morning,
Afternoon, and Night
and eventually accrue for overtime. Depending on the shift in which
they work, the salary varies.
Sellers earn a base salary plus sales commissions. Has a zone
assigned
or region in which you are responsible for the distribution of the
company's products.
The minimum attributes to consider are: ID, names, surnames, date
of birth, level
educational.
In: Computer Science
Assignment 2 (worth 10% of the final course grade - due date July 23, 2019) Prof. Sherif Saad Purpose The purpose of this assignment is to help you to practice working with C String, arrays, and pointers Learning Outcomes ● Develop skills with pointers ● Learn how to traverse C String using pointers ● Passing Strings to functions ● Manipulate C String ● Develop algorithm design skills Problem Overview You will implement a basic string manipulation library called xstring.h. This library provides the ability to manipulate and search native C strings. The library offers the following functions int FindFirstOccurrence(char c , char *pStr ); //[5 Points] /* This function takes two parameters the first is a variable of type char and the second is a pointer of type char that point to a string variable. The function will parse the string and return the index of the first occurrence of the char variable in the string. If the character does not exist, it will return -1 example pStr = "Hello World!" c = 'o' The function will return 4, because the first o occurred at index 4 in the string */ int FindLastOccurrence(char c, char * ); //[5 Points] /* This function takes two parameters the first is a variable of type char and the second is a pointer of type char that point to a string variable. The function will parse the string and return the index of the last occurrence of the char variable in the string. If the character does not exist, it will return -1 University of Windsor COMP141- Summer 2019 School of Computer Science example pStr = "Hello World!" c = 'o' The function will return 7, because the last o occurred at index 4 in the string */ int GetStringWeight (char *pStr ); // [10 Points] /* This function takes one parameter, which is a char pointer variable that points to a C string. The function will calculate and return the weight of the C string. The weight of the C string is the total sum of the ASCII code representation of the characters in that string. example pStr = "Cat" The function will return 280 since ASCII('C') = 67, ASCII('a') = 97 , and ASCII('t') = 116 */ void ReplaceCharacter(char x , char c , char * pStr); // [10 points] /* This function takes three parameters the first and the second are variables of type char, and the third is a pointer of type char that point to a string variable. The function will parse the string using pStr and every time it finds a character that matches the value of x it will replace it with the value stored in c. example pStr = "banana and apple" x = 'a' c = 'e' The function will change pStr to "benene end epple" */ University of Windsor COMP141- Summer 2019 School of Computer Science void ToUpperCase(char * pStr); // [10 points] /* This function takes one parameter, which is a char pointer variable that points to a C string. The function will convert all the lower case alphabetic characters to uppercase characters. example pStr = "The Cat in The Hat" The function will change pStr to "THE CAT IN THE HAT" */ void ToLowerCase(char *pstr); // [10 points] /* This function takes one parameter, which is a char pointer variable that points to a C string. The function will convert all the uppercase alphabetic characters to lowercase characters. example pStr = "COMPUTER" The function will change pStr to "computer" */ void RemoveCharacter(char c , char str[] ); // [15 points] /* This function takes two parameters the first is a variable of type char and the second is a char array that store to a C string. The function will parse the C string and remove any character in the string that matches the character value stored in c example str = "Cats Hats Tags" c = 's' The function will change str to "Cat Hat Tag" */ University of Windsor COMP141- Summer 2019 School of Computer Science void ReverseString(char *pStr); // [15 points] /* This function takes one parameter, which is a char pointer variable that points to a C string. The function will reverse the string. example pStr = "Pass the test" The function will change pStr to "tset eht ssaP" */ Instructions You will use the provide code skeleton to complete the assignment. The code skeleton consist of three files. These three files are main.c, xstring.c and xstring.h. The main.c conatins the main program that allows the user to enter any string and characters to manipulate using the xstring library. The xstring.h file contains the function prototypes of the xstring library. Finally, the xstring.c file contains the implementation (function definition) of the xstring library. You are required to: 1. Complete the implementation of the functions and fix any existing bug in the code functions [80 points] 2. Link the main.c file and the xstring.c file using the xstring.h file as shown the lecture notes, please see lecture 3 [10 points] 3. Compile and run the main to test your implementation [10 points] IMPORTANT NOTES: 1. You can create any additional function you think they are necessary to implement the xstring library. 2. You should NOT use any built-in function from the C String library (e.g strlen, strcpy, etc)
In: Computer Science
Discuss the difference between the IP, DNS and MAC addresses – how do the relate to one another in a network?
In: Computer Science
Using Visual Studio write a program that allows the user to enter multiple scores ranging from 0 to 100, computes the average of
those scores and then writes out a letter grade using the typical grading scale. Your program will also:
1. Allow the user to enter any number of scores he or she wishes but assume there will be at least one
score entered.
2. Use a sentinel-controlled loop variable to terminate the loop when the user has no more scores to
enter. Hold user in a loop if a “yes” or “no” is not entered.
3. Use the TryParse method, to hold the user in a loop if a non-numeric value is entered. To exit the loop,
the user must enter correct input.
4. Hold the user in a loop if a value less than 0 or greater than 100 is entered.
In: Computer Science