Questions
What is the PID for xeyes?

What is the PID for xeyes?

In: Computer Science

Create a Java program with a method that searches an integer array for a specified integer...

Create a Java program with a method that searches an integer array for a specified integer value **(see help with starting the method header below). If the array contains the specified integer, the method should return its index in the array. If not, the method should throw an Exception stating "Element not found in array" and end gracefully. Test the method in main with an array that you make and with user input for the "needle".

starting header

**

public static int returnIndex(int[ ] haystack, int needle) {

In: Computer Science

Code should be written in C Use pointer variables for parameter passing, where appropriate and pointer...

Code should be written in C

Use pointer variables for parameter passing, where appropriate and pointer arithmetic when working with arrays.

1) Using initialization lists, create 5 one-dimensional arrays, one for each of these:

  • hold the names of the people running in the election
  • hold the names of the subdivision
  • hold the vote counts in the Brampton subdivision for each candidate
  • hold the vote counts in the Pickering subdivision for each candidate
  • hold the vote counts in the Markham subdivision for each candidate

Use the data from the example below.

* Your C program should take the data in the arrays and produce the output below, neatly formatted as shown:

Candidates                            Subdivisions                 Totals

                             Brampton  Pickering Markham        

Aubrey                     600            800          800            2200

Blake 700            700          600            2000

Chubbs 800           700          800           etc

Oliver 400            450         300             

Zamier 900            900       900            

Totals                     3400            etc                              etc

  1. Create a function that will find the total votes in one subdivision and return that to main( ). Call this function 3 times to produce the 3 totals in the last line of output.
  2. Create a function that will find the total votes for one candidate and return that to main( ). Call this function 5 times to produce the 5 totals in the last column of output. Be very careful with the parameter list here. Send the function only the information it needs.
  3. Create a function that will output the first 2 lines of headings.

In: Computer Science

Consider the computer attacks in the previous chapters. How would a VPN protect a user from...

Consider the computer attacks in the previous chapters. How would a VPN protect a user from one or more of them?

In: Computer Science

Starting a Family Video, This is an SQL Assingment Each family video has a store number,...

Starting a Family Video, This is an SQL Assingment

Each family video has a store number, a street address, city, state, zipcode, and phone number. Each store will have a number of employees. Each staff member should have an employee number, name, salary, phone number. Each store should have a single employee that is the manager for that store.

assume that every DVD is a movie. Every movie will have a title and a single category (Action, Drama, Horrow, SciFi, etc.). Any given store will have any number of DVD copies of a movie. The rental cost is set for the movie and is the same across all stores.

Family Video track of all borrowers (borrower number,name, phone number). A borrower is allowed to rent from any store, and may rent any number of items, but each rented item must record the day it was rented and its return date.

1. Identify and list the strong entities.
2. Identify and list the weak entities.
3. For each entity list its attributes.
4. Identify and list the relationships between entities. If the relationship has any attributes, list them.
5. Draw the E/R diagram for your model.

In: Computer Science

What should be examined during a review? List and describe six things that should be examined.

What should be examined during a review? List and describe six things that should be examined.

In: Computer Science

Suppose you are the director of the sales department of Easy Toys Ltd. You need a...

Suppose you are the director of the sales department of Easy Toys Ltd. You need a database application to record your new business leads. Your requirements are:

1 The identity of the staff who is developing the new business lead, including the staff’s first name, last name, and employee number.

2 The identity of the potential client, including the company name, key contact person, and the company address.

3 Information about each new business lead, including the type of product classifications (e.g. STEM / dolls / electronic toys / cars).

4 Information about each contact made to develop the new business lead, including the date of the contact, how much time the staff has spent on the contact, and a brief summary of the points discussed.

The IT department of Easy Toy Ltd tells you that they already have a lot of backlog and they cannot handle your request. You decide to build the system with one of your sales managers. Your sales manager proposes the following relational database design:

Table name

Primary key

Non-key attributes

Business lead

Employee name

First name, Last name, Company name, Key contact person, New product classification, Date of contact, Time spent, Brief summary

Required:

a) What are the problems in the above relational database design proposed by the sales manager?

b) Recommend a relational database design that can eliminate all the problems identified in part (a)

In: Computer Science

1. If you stored the following binary number (-0.000000100101) as a binary floating point number, what...

1. If you stored the following binary number (-0.000000100101) as a binary floating point number, what value would be STORED in the exponent section? Also convert A7.11 Hex value to floating point.

2. Number of bits saved using Huffman encoding. From the following characters used in a message with their associated frequency, use Huffman Coding as a compression technique. How many bits will be saved in the message? (Keep in mind that one character is one byte which consists of 8 bits). Draw the associated Huffman Tree to help calculate your answer. Show all your work. (15 points)

Character                                                                                            Frequency

A

6

B

11

C

13

D

14

E

19

F

47

In: Computer Science

#1. There is an error in the code. Not a grave error – the sort still...

#1. There is an error in the code. Not a grave error – the sort still works correctly. What is the
error?
( no code needs to be added or deleted to correct the error )
#2. The algorithm can be improved in terms of memory use. How? ( no new code is necessary )
# 3. What do lines 26-27 do ? ( copying arryptr into temp is not the complete answer. Be
specific )
#4.What do lines 30-31 do ? (copying arryptr into temp is not the complete answer. Be
specific )
#5. Draw a tree diagram ( as above ) illustrating the order of calls ( along with the mid ) for the
array
77 44 99 11 -666 22 55 -23

mergesortcode

template
void mergesort(T* arrayptr, const int& arraySize )
{
sortmerge( arrayptr, arraySize, 0, arraySize − 1 );
}

template
void sortmerge( T *arrayptr, int arraySize, int l, int r )
{

int mid, i, j, k;

T* temp = new T[ arraySize ];

if ( l < r )
{
mid = (r + l)/2;

sortmerge( arrayptr, arraySize, l, mid );
sortmerge( arrayptr, arraySize, mid + 1, r );


for ( i = mid + 1; i > l; i−− )
temp[ i − 1 ]= arrayptr[ i − 1 ];

for ( j = mid; j < r; j++ )
temp[ r + mid − j ] = arrayptr[ j + 1 ];

for ( k = l; k <= r; k++)
arrayptr[k] = ( temp[i] < temp[j] ) ? temp[i++] : temp[j−−];

temp = 0;
delete [] temp;
}

In: Computer Science

Write a C# program that prints a calendar for a given year. Call this program calendar....

Write a C# program that prints a calendar for a given year. Call this program calendar. The program prompts the user for two inputs:
      1) The year for which you are generating the calendar.
      2) The day of the week that January first is on, you will use the following notation to set the day of the week:
    
      0 Sunday                     1 Monday                   2 Tuesday                   3 Wednesday
      4 Thursday                 5 Friday                      6 Saturday

Your program should generate a calendar similar to the one shown in the example output below. The calendar should be printed on the screen. Your program should be able to handle leap years. A leap year is a year in which we have 366 days. That extra day comes at the end of February. Thus, a leap year has 366 days with 29 days in February. A century year is a leap year if it is divisible by 400. Other years divisible by 4 but not by 100 are also leap years.

Example: Year 2000 is a leap year because it is divisible by 400.  Year 2004 is a leap year because it is divisible by 4 but not by 100.
Your program should clearly describe the functionality of each function and should display the instructions on how to run the program.

Your need to create one method “displayMonth” for print each month as required. You can choose return method or not that depend on your design.

Sample Input:

Enter the year for which you wish to generate the calendar: 2004
Enter the day of the week that January first is on: 4

Sample output:

Calendar for year 2004

January
Sun      Mon     Tue      Wed     Thu      Fri        Sat
                                                1          2          3
4          5          6          7          8          9          10
11        12        13        14        15        16        17
18        19        20        21        22        23        24
25        26        27        28        29        30        31

February
Sun      Mon     Tue      Wed     Thu      Fri        Sat
1          2          3          4          5          6          7
..         ..          ..          ..          ..          ..          ..
..          ..

In: Computer Science

repare a single compressed file in .zip format containing all the source files (.java files, NOT...

repare a single compressed file in .zip format containing all the source files (.java files, NOT .class files) and the output file generated by running your code (i.e., testsOutput.txt) and submit it through Moodle. To be more precise, your submitted .zip file should contain the following files: PhoneCard.java, SuperNA10Card, Global10Card, Global25Card, SuperPhoneCardInc.java, CardTable.java, CallZone.java, and testsOutput.txt.

Note:

(1) Your assignment will be given a zero mark if only the compiled files (.class files) are submitted. No exceptions. Please make sure to submit the source files (.java files).

(2) Please make sure your code compiles under the command line (i.e., without an IDE). All Java classes should be put under the default package. Do not put any package statement at the beginning of your source file. If you are using an IDE, this is especially important because some IDEs put your code under a particular package for your project. Any code that does not compile under the command line can only receive 20/100. (See below for the marking scheme).

(3) Finish only the parts as indicated; do not attempt to change other parts of the code.

(4) Please pay attention to variable naming. JavaDoc comments are required for both the code you write and the code already provided.

(5) Please pay close attention to the formatting of the output. For example, when asked to print charged X.XX, make sure only two digits are printed after the decimal point. (Hint: Use DecimalFormat or System.out.printf().)

Details

SuperPhoneCard Inc. sells phone cards for making cheap long distance calls around the world. In this assignment, you will write a (much simplified) Java program to manage their business.

SuperPhoneCard Inc. sells 3 types of phone cards: SuperNA10 cards, which cost $10 and are good only for calls in Canada and the USA, Global10 cards, which cost $10 and are good for overseas calls, and Global25 cards, which cost $25 and are also good for overseas calls. The per minute rates for each type of card and call zone are as follows:

SuperNA10 Global10 Global25
Canada $0.05 $0.07 $0.05
USA $0.10 $0.15 $0.10
Europe XXXXX $0.30 $0.20
Asia XXXXX $0.60 $0.40
Australia & NZ XXXXX $0.45 $0.30
Latin America XXXXX $0.45 $0.30
Africa XXXXX $0.60 $0.40

The initial balance on the cards and the weekly maintenance fee are indicated below:

SuperNA10 Global10 Global25
initial balance $10.00 $10.00 $25.00
weekly fee $0.50 $1.00 $1.00

Your main job in this assignement is to implement a hierarchy of classes to represent the different types of cards. At the top of the hierarchy, there is an abstract class PhoneCard with the following API:

  • public PhoneCard(long no, int passwd, double bal): a constructor (precondition: no and passwd must be positive);
  • public long getNumber(): an accessor returning the card number;
  • public int getPassword(): an accessor returning the card password;
  • public double getBalance(): an accessor returning the card balance;
  • public void setBalance(double bal): a mutator to set the card balance;
  • public abstract boolean allowed(String zone): a predicate that returns true if a call to the argument zone is allowed for the card;
  • public abstract double costPerMin(String zone): returns the cost per minute of a call to the argument zone;
  • public int getLimit(String zone): returns the maximum number of minutes that can be charged for a call to the argument zone given the card's balance (truncated down to the next integer);
  • public boolean charge(int minutes, String zone): tries to charge a call to the given zone with the given number of minutes to the card; if the balance is sufficient to cover it, it returns true and if the balance is not sufficient, it leaves it unchanged and returns false (precondition: minutes must be positive);
  • public abstract void deductWeeklyFee(): deducts the appropriate weekly fees from the card's balance, leaving it non-negative;
  • public String toString(): returns the string "card no no has a balance of X.XX".

There are also 3 classes, SuperNA10Card, Global10Card, and Global25Card that inherit from PhoneCard, and model the properties of the associated type of card as specified above, by defining the PhoneCard class's abstract methods. These classes should use the supplied CallZone.java class to check if the strings representing the call zones are valid.

Once you have defined these classes, you should then complete the application that SuperPhoneCard Inc. will use to manage its business. This application is implemented by the SuperPhoneCardInc class, that reads and processes a number of commands from the standard input stream for processing cards and calls, outputing the results on the standard output stream. The commands are:

  • add no passwd cardType: adds a card of the given type with the given number, password, and type (a cardType is either SuperNA10, Global10, or Global25);
  • getBalance no passwd: prints the balance of card no if the password passwd is valid;
  • getLimit no passwd callZone: prints the maximum number of minutes that can be charged to card no for a call to callZone given the card's balance if the password passwd is valid and calls to callZone are allowed for this card (a callZone is either CANADA, USA, EUROPE, ASIA, ANZ, LATINAM, or AFRICA);
  • charge no passwd callZone minutes: charges card no for a call of minutes to callZone if the password passwd is valid, the balance is sufficient, and calls to callZone are allowed for this card;
  • deductWeeklyFee: deducts the weekly fee from all cards;
  • printAll: prints the balance of all cards.

An incomplete definition for the SuperPhoneCardInc class is available here in SuperPhoneCardInc.java. You must fill out the missing parts of the definition, i.e. the code for handling the following commands:

  • getLimit no passwd callZone: if the command can be executed successfully, print "Result: card no limit for zone callZone is XX minutes", otherwise print error messages as follows: if the number of arguments or their type is wrong, print "Error: invalid arguments for getLimit command"; if the card does not exists, print "Error: card no no does not exist"; if the card's password is wrong, print "Error: password passwd incorrect"; and if calls to the given zone are not allowed for this card, print "Error: card no not allowed for zone callZone";
  • charge no passwd callZone minutes: if the command can be executed successfully, print "Result: card no charged X.XX, new balance is Y.YY", otherwise print error messages as follows: if the number of arguments or their type is wrong, print "Error: invalid arguments for charge command"; if the card does not exists, print "Error: card no no does not exist"; if the card's password is wrong, print "Error: password passwd incorrect"; and if calls to the given zone are not allowed for this card, print "Error: card no not allowed for zone callZone"; and if the card's balance is not sufficient to cover the call, print "Error: card no limit for zone callZone is XX minutes".

The SuperPhoneCardInc uses another class CardTable to manage a table of PhoneCards. An incomplete definition for the CardTable class is available here in CardTable.java. You must also fill out the missing parts of the definition of CardTable, i.e. the public PhoneCard get(long no) method that returns the first phone card in the table whose number matches the argument, or null if there is no card with this number.

Make sure your code compiles and runs under Java SE Development Kit 8 or above. Once you have implemented and thoroughly tested all of these classes, run your application on the test data file testsInput.txt and save your output in the file testsOutput.txt. You can do this by redirecting the standard input stream and standard output stream with the command:

java -ea SuperPhoneCardInc < testsInput.txt > testsOutput.txt

Then submit a zipped archive with all your source code files (containing PhoneCard.java, SuperNA10Card, Global10Card, Global25Card, SuperPhoneCardInc.java, CardTable.java, and CallZone.java) and testsOutput.txt by the deadline as specified above. The test output file corresponding to the given testsInput.txt is here. Note that we are going to use a different input file to test your program.

In: Computer Science

Explain from your own words the different factors affecting the processing speed of CPU.

Explain from your own words the different factors affecting the processing speed of CPU.

In: Computer Science

Implement the following functions in C: LinkedStack* InitStack(); int IsEmptyStack(LinkedStack* LStack); LinkedStack* LinkedPush(LinkedStack* LStack, Eletype value);...

Implement the following functions in C:

LinkedStack* InitStack();
int IsEmptyStack(LinkedStack* LStack);


LinkedStack* LinkedPush(LinkedStack* LStack, Eletype value);
// Return the head of stack.


Eletype LinkedPop(LinkedStack* LStack);
// Return the value of popped element.


Eletype FrontStack(LinkedStack* LStack);
// Return the value of the element on the top of stack.

InitStack() returns an empty stack and IsEmptyStack(LinkedStack* LStack) determines if the stack is empty or not.

In: Computer Science

can someone explain to me circular, double, linked list? can someone show a program on how...

can someone explain to me circular, double, linked list?

can someone show a program on how you would go about using recursive with proper functions and one not using recursive but somethibg simikar!

bibary search tree, preorder, post order?

good explanation of linked list sorted.

In: Computer Science

1,Evaluate the accuracy and reliability of different research methods applied. 2. Critically evaluate the project management...

1,Evaluate the accuracy and reliability of different research methods applied.

2. Critically evaluate the project management process and appropriate research methodologies applied.

In: Computer Science