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 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 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. 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 .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:
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:
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:
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.
In: Computer Science
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
In: Computer Science
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
**********Java language************
1- (Conversions between Celsius and Fahrenheit) Write a class that contains the following two methods:
/** Convert from Celsius to Fahrenheit */
public static double celsiusToFahrenheit(double celsius)
/** Convert from Fahrenheit to Celsius */
public static double fahrenheitToCelsius(double fahrenheit)
The formula for the conversion is:
Celsius = (5.0 / 9) * (Fahrenheit – 32)
Fahrenheit = (9.0 / 5) * Celsius + 32
Program output should be like:
If you want to convert from Fahrenheit To Celsius press 0 vice versa press 1:
0
Enter the degree in Fahrenheit: 22
The degree in Celsius: -5.5
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.
If you want to convert from Fahrenheit To Celsius press 0 vice versa press 1:
1
Enter the degree in Celsius: 33
The degree in Celsius: 91.4
In: Computer Science
In PYTHON:
Write a program that asks for a password from a user and checks if it satisfies the conditions:
If the password is valid, then the program prints “password accepted”. Otherwise, it keeps asking for more passwords from the user until a valid password is obtained.
Hint: You might like to check the string methods that start with the letter ‘i’.
In: Computer Science
Reading code that you haven't written is a skill you must develop. Many times you are correcting this code that you didn't write so you have to 1) read the code, 2) find the errors, and 3) correct them.
# Describe the error found in this function:
def get_grade():
grade = int(input("Enter your test score > ")
# Describe the error found in this function:
def all_As(test1, test2, test3):
if test1 > 89:
if test2 > 89:
if test3 > 89:
print("Wow! ", end="")
print("You scored 90 or above on all your exams!")
print("Keep up the As!")
print()
# Describe the error found in this function:
def calc_average(test1, test2, test3):
average = test1 + test2 + test3 / 3
return average
# Describe the error found in this function:
def letter_grade(grade):
if grade >= 90:
print("You earned an A")
if grade >= 80:
print("You earned an B")
if grade >= 70:
print("You earned an C")
if grade >= 60:
print("You earned an D")
if grade < 60:
print("You earned an F")
from grades import (
all_As,
calc_average,
get_grade,
letter_grade
)
# THERE ARE NO ERRORS IN THE MAIN
# YOU DO NOT NEED TO CHANGE THE MAIN
#-----main-----
print("Enter 3 test scores:")
first_test = get_grade()
second_test = get_grade()
third_test = get_grade()
print()
all_As(first_test, second_test, third_test)
average = calc_average(first_test, second_test, third_test)
print("Your test average is",average)
letter_grade(average)
When the program is correct, it should have output like this:
Enter 3 test scores: Enter your test score > 100 Enter your test score > 90 Enter your test score > 91 Wow! You scored 90 or above on all your exams! Keep up the As! Your test average is 93.66666666666667 You earned an A
In: Computer Science
In PYTHON:
Write a function that receives an encrypted string and decrypts it as follows. The decryption does not change the lowercase letters ‘e’, ‘w’, and ‘l’ (lowercase L). For any other character, we change it to a number using ord(). We then take the number to a power of 19, and then find the remainder after diving by 201. Finally, we take the character corresponding to the number we obtained (using chr()).
For example, assume that we receive the character ‘Â’, which corresponds to the number 194. We calculate the reminder when dividing 19419 by 201, obtaining 122. Using chr(), we find that this is the letter ‘z’.
Your function is not allowed to automatically replace every ‘Â’ with a ‘z’. Instead, it should separately perform the above calculation for each character in the encrypted text.
More details: Your function should handle one character at a time. For each character, turn it to a number, take it to the power of 19, find the remainder when dividing by 201, and turn back to a letter. Don’t forget the three lowercase letters that remain unchanged.
In: Computer Science
Add each element in origList with the corresponding value in
offsetAmount. Print each sum followed by a space.
Ex: If origList = {4, 5, 10, 12} and offsetAmount = {2, 4, 7, 3},
print:
6 9 17 15
import java.util.Scanner;
public class VectorElementOperations {
public static void main (String [] args) {
final int NUM_VALS = 4;
int[] origList = new int[NUM_VALS];
int[] offsetAmount = new int[NUM_VALS];
int i;
origList[0] = 20;
origList[1] = 30;
origList[2] = 40;
origList[3] = 50;
offsetAmount[0] = 4;
offsetAmount[1] = 6;
offsetAmount[2] = 2;
offsetAmount[3] = 8;
*insert code*
System.out.println("");
}
}
In: Computer Science
Question about CyberForensic
In: Computer Science