Why is it important to learn the various signals associated with
the kill command?
In: Computer Science
When customers place an order, the order details will need to be stored into the database, as well as details of the customer. Naturally this will include details such as name, address and phone number. For each order they can order multiple t-shirts. For each t-shirt, they will be allowed to choose:
- The style of the t-shirt
- The sleeve configuration
- The colour of the t-shirt
- The size of the t-shirt
- The text/image/logo to be printed
- The material used for t-shjirt
- The material used for the text/image/logo
It is extremely important to store the data in a structured format, because it will be used to send directly to the automated T-Shirt create equipment to be instantly created and shipped. Customers will be required to pay before the products are sent so details will need to be kept of the payment. Your friends are planning to accept payment by credit card, direct bank deposit and paypal. For credit cards they need to store the credit card number and expiry date, for direct deposit they need a field to tick off that the payment has appeared in their bank account and for paypal they again need a field to tick off plus the paypal user id of the payer.
Sample T-Shirt | T-Shirt Attrribute | Data |
Type: Shirt_Material: Sleeve: Shirt_Colour: Extras: Extras_Material: Extras_Font Extras_colour Size: |
Standard Cotton Short White Text “SAMPLE T-SHIRT” Ink 48 Time New Roman Orange XL |
|
Type: Shirt_Material: Sleeve: Shirt_Colour: Extras: Extras_Material: Extras_Font Extras_colour Size: |
Standard Leather Short Black - - - - M |
REQUIREMENTS – PASS/CREDIT – DATA MDOEL
Create an ER diagram, relational model and any business rules or assumptions made.
REQUIREMENTS – HIGHER LEVEL – SQL IMPLEMENTATION
For additional marks, provide the SQL commands to create the tables and insert a few rows into each table. Also provide several business question and SQL queries to test out the tables, include at least a:
• SELECTION condition query
• GROUP BY query
• JOIN query
• NESTED query
Also create a least one visualisation of the data using Orange/Tableau/Excel.
In: Computer Science
Use the Pumping Lemma to show that the following languages are not regular.
(a) {ai bj | i > j}
(b) {apaq | for all integers p and q where q is a prime number and p is not prime}.
In: Computer Science
Program Requirements:
This assignment requires you to create one program in
Java to simulate a Point-of-Sale (POS) system. The
solution must be in JAVA language.
You create the main program called POSmain.java and two classes:
ShoppingCart and CashRegister.
Your POSmain program should take three file names from command line
arguments. The first file contains a list of products and their
prices; the second and third files are lists of items in two
shopping carts of two customers. The POSmain program should first
read the price file, then read each of the cart files to load a
list of items in a shopping cart and store them in a ShoppingCart
objects. The price file may contain a variable number of products
and the cart files may contain a variable number of items.
POSmain then will create a CashRegister object by passing the price
list to it. The POSmain program then will use the CashRegister
object to scan items in a cart and print a receipt for each
shopping cart one by one. At last, POSmain will use the
CashRegister object to print a report for the day.
The students will the report for the day, which requires design of
your CashRegister class.
cart1.txt:
TV
Table
Table
Bed
Bed
Chair
Chair
Chair
Chair
cart2.txt:
Milk
Butter
Tomato
Tomato
Tomato
Tomato
Tomato
Onion
Onion
Onion
Lettuce
Milk
Ham
Bread
Bread
price.txt:
TV
999.99
Table 199
Bed 499.99
Chair 45.49
Milk 3.00
Butter 2.84
Tomato 0.76
Onion 0.54
Lettuce 1.00
Ham 2.50
Bread 1.75
Program Output:
One customer is checking out ...
========================================
Product Price Qty Subtotal
----------------------------------------
Bed $499.99 2 $999.98
Char $45.49 4 $181.96
TV $999.99 1 $999.99
Table $199.0 2 $398.0
-------------------------
Total $2579.93
========================================
One customer is checking out ...
========================================
Product Price Qty Subtotal
----------------------------------------
Bread $1.75 2 $3.5
Butter $2.84 1 $2.84
Ham $2.5 1 $2.5
Lettuce $1.0 1 $1.0
Milk $3.0 2 $6.0
Onions $0.54 3 $1.62
Tomato $0.76 5 $3.8
-------------------------
Total $21.26
========================================
Report for the day
========================================
Number of customers: 2
Total sale: $2601.19
List of products sold:
----------------------------------------
Product Qty
----------------------------------------
Bed 2
Bread 2
Butter 1
Char 4
Ham 1
Lettuce 1
Milk 2
Onions 3
TV 1
Table 2
Tomato 5
In: Computer Science
Suppose a gas company bases its charges on consumption according to the following table:
Gas Used | Rate |
---|---|
First 70 cubic meters | $5.00 minimum cost |
Next 100 cubic meters | $0.05 per cubic meter |
Next 230 cubic meters | $0.025 per cubic meter |
Above 400 cubic meters | $0.015 per cubic meter |
Write a program in C++ that asks the user to enter the number of
cubic meters of gas used, calculates the charges, and displays the
total charge.
In: Computer Science
Part A - Palindromic Bitlists Write a function palindrome binary(n) which returns a list of bitlists of length n, where every bitlist is a palindrome. The returned list of bitlists must be in lexicographical order (think about the order of your options). You must use backtracking to solve this problem (i.e. do not use brute force).
Part B - All Paths Write a function all paths(M, u, v) which takes as input an adjacency matrix of a graph, M, and two vertices u, v and returns a list of all paths from u to v in M. A path is a list of vertices. Note that a path cannot use the same vertex twice, but two different paths can use some of the same vertices. The returned list of paths must be in lexicographical order. You must use backtracking to solve this problem (i.e. do not use brute force).
PYTHON CODE
In: Computer Science
IN JAVA(NETBEANS) PLEASE:
The cost to become a member of a fitness center is as follows: (a) the Senior citizens discount is 30%; (b) if the membership is bought and paid for 12 or more months in advance, the discount is 15%; or (c) if more than 5 personal training sessions are purchased, the discount on each session is 20%. Write a menu driven program that determines the cost of a new membership. Your program must contain a method that displays the general information about the fitness center and its charges, a method to get all the necessary information to determine the membership cost, and a method to determine the membership cost. Use appropriate parameters to pass information in and out of a method. Implement the program as specified below: METHOD displayGeneralInformation - displays all of the costs and asks for the age Welcome to Fitness Center Service Costs 3 month membership $350 6 month membership $600 Java Programming: From Problem Analysis to Program Design 7-2 1 year membership $1000 (15% discount if paid in full) Personal training sessions $80/hour for each session (20% discount on each session if more than 5 sessions are purchased) ***If you are 55 years or older, you will receive a 30% discount Please enter your age: METHOD getDataMenu - shows the menu and returns the value entered 1. Purchase Membership 2. Purchase Sessions Choose from the Menu: METHOD: getMembershipCost If option 1 from menu above entered: A- 3 month membership $350 B- 6 month membership $600 C- 1 year membership $1000 (15% discount if paid in full) Choose your membership level: METHOD: getTrainingSessionsCost - returns training session cost If option 2 entered: Enter the number of sessions you would like to purchase: METHOD: totalMembershipCost Your total membership cost is: $…… Note: Senior citizens who buy a 12 month membership and pay in full will first receive 30% off the 1,000 and then 15% off the remaining balance. Senior citizens also receive 15% off training sessions. Discussion the 20% off first if more than 5 sessions and then discount the 15% from the balance.
In: Computer Science
Please Note: Only do Problem 2 and please read Problem 2 carefully the requirements thanks /*********************************** * Filename: arraySorted.c * Author: Last name, first name * Email: Your preferred email address * Login ID: Your EECS login ID ************************************/ #include <stdio.h> /********* DO NOT CHANGE THESE CONSTANTS IN THE FINAL SUBMISSION *********/ #define MAX_SIZE 20 #define SUCCESS 0 /****************** YOUR CODE STARTS HERE ******************/ /************************************************************/ /* Input: array A with "size" elements and an integer d Output: d is added to the array. Return 0 if the addition is successful. Return a negative number if the addition is unsuccessful. Error condition(s): fill in the error condition(s). */ int myAdd( int A[], int size, int d ) { /* ADD YOUR CODE HERE */ return 0; } /* Input: array A with "size" elements and an integer d Output: If d is found in the array, return the index of the cell containing d. Otherwise return a negative number if d is not found. Error condition(s): fill in the error condition(s). */ int search( int A[], int size, int d ) { /* ADD YOUR CODE HERE */ return 0; } /* Input: array A with "size" elements and an integer d Output: Return a negative number if d is not found. Otherwise d is removed from the array and return 0. Error condition(s): fill in the error condition(s). */ int myRemove( int A[], int size, int d ) { /* ADD YOUR CODE HERE */ return 0; } /******************* YOUR CODE ENDS HERE *******************/ /************************************************************/ /********* DO NOT CHANGE ANYTHING BELOW THIS LINE IN THE FINAL SUBMISSION *********/ /* Input: array A with "size" elements Output: Display the array on the standard output with one space between every two numbers. Print a new line after the last element. If the array is empty, print "Empty array" and a new line. Error condition(s): fill in the error condition(s). */ int printArray( int A[], int size ) { int i; if ( size == 0 ) printf( "Empty array\n" ); else { for ( i = 0; i < size; i++ ) printf("%d ", A[ i ] ); printf( "\n" ); } return 0; } /* main() function */ int main() { int myArray[MAX_SIZE]; int retCode, data, size; char action; size = 0; do { scanf( "%d %c", &data, &action ); switch( action ) { case 'a': /* add */ case 'A': retCode = myAdd( myArray, size, data ); if ( retCode == SUCCESS ) { size++; // increment size after successful addition printArray( myArray, size ); } else printf( "Failed to add %d.\n", data ); break; case 'r': /* remove */ case 'R': retCode = myRemove( myArray, size, data ); if ( retCode == SUCCESS ) { size--; // decrement size after successful removal printArray( myArray, size ); } else printf( "Failed to remove %d.\n", data ); break; case 's': /* search */ case 'S': retCode = search( myArray, size, data ); if( retCode >= 0 ) printf( "Found %d at index %d.\n", data, retCode ); else printf( "Not found %d.\n", data ); break; case 'q': /* quit */ case 'Q': /* To quit, enter an arbitrary integer and character (action) 'q' or 'Q'. This is not elegant but makes the code simpler. */ /* Do nothing but exit the switch statement */ break; default: printf( "Invalid operation %c\n", action ); } } while ( action != 'q' && action != 'Q' ); return 0; } // end main
Problem 1: Unsorted arrays Given an array of integers that is unsorted, implement the following functions: • myAdd ( ): add an integer d to the array; return 0 if the operation is successful; return a negative number otherwise. • myRemove ( ): remove integer d from the array; return 0 if the operation is successful; return a negative number otherwise (e.g., d is not found in the array). • search ( ): given an integer d, if d is found in the array, return the index of the cell containing d. Return a negative number otherwise (e.g., d is not found in the array). Notes: • The functions (algorithms) must be the most efficient in terms of running time and memory usage. • Submit file arrayUnsorted.c. Complete the header with your student and contact information. Include sufficient comments in your code to facilitate code inspection. • Submit a report in PDF with following information: references (sources); error conditions and actions taken; brief algorithm; running time of the function (algorithm) and a brief explanation. See the template a1report.docx for an example. • See file a1output.txt for sample output. • Your code will be graded automatically by a script, so make sure to strictly follow the specifications. • Do not use any output statements (for example, printf) in your code, or they will mess up the grading scripts. • Use the main( ) function provided to test your code. Understanding the code in the main( ) function is part of the assignment. Do not change the code in the main( ) function in the final submission, or your program will mess up the grading script.
Problem 2: Sorted arrays This problem is the same as the above problem, except that the array of interreges is sorted and must always be maintained in non-decreasing order at any point in time. Note: Do not use any sorting algorithm in the program
In: Computer Science
Write MIPS code for finding the (estimated) square-root of a number N, by using the following pseudo-code:
sqrt = N; repeat 10 times {
sqrt = (sqrt + N/sqrt)/2; }
The number N is entered by the user and the answer is displayed on the screen as (for example):
The square root of 121 is 11.
Write MIPS code for finding the distance between two points [x1,y1] and [x2,y2]. The formula for the distance is:
z = ?(x2 − x1)2 + (y2 − y1)2
x1,x2,y1 and y2 are entered by the user and the answer z is
displayed on the screen as
(for example):
The distance is 12.
(Hint: Reuse the square-root code from the previous question.
Write MIPS code that finds and prints the smallest number in the integer array “arr”. The declaration of the array is shown below:
.data arr: .word 100, 10, 3, -2, 110, 0, -50, 150, -17, 8
In: Computer Science
Design an O(nlogn) algorithm that takes two arrays A and B (not necessarily sorted) of size n of real numbers and a value v. The algorithm returns i and j if there exist i and j such that A[i] + B[j] = v and no otherwise. Describe your algorithm in English and give its time analysis.
In: Computer Science
1.Discuss the Associative Arrays in C# and Java, with example, mention the different operations.
2.Is the size static or dynamic?
In: Computer Science
Submit your complete implementation of our abstract list type using an array, ArrayList.java.
public class ArrayList {
public static void main(String[] args) {
ArrayList list = new ArrayList();
}
private String[]a = new String[1000];
private int end = -1;
// Throw an IndexOutOfBoundsException if the index is invalid public String get(int index); // Return the first index in the list with the given value, or -1 if it's not found public int find(String val); // Return true if the element is successfully added, false if the list is full public boolean add(String val); // Throw an IndexOutOfBoundsException if the index is invalid public void add(int index, String val); // This method should return true only if the value is in the list and removed, // false if the value isn't found in the list public boolean remove(String val); // return the value that's removed; throw an IndexOutOfBoundsException if the index is invalid public String remove(int index); // LENGTH() → int public int size(); // Return true if the list is empty, false if it's not public boolean isEmpty(); // Return true if the value is in the list, false if it's not public boolean contains(String value); // DELETE_ALL() public void clear(); // Convert the contents into a single string with values separated by commas. // It's OK to have a comma at the end of the String. public String toString();
In: Computer Science
Using C language
Problem!! <3 x 3 tic tac toe>
2 players are doing tic tac toe alternatively. Anyone could win when they first make a bingo for any line(horizontal, vertical, diagonal)
[Constraints]
1. Use 2dimensional Array(3 X 3)
2. Each elements are 1 or 2 so that can show their player1, player2's mark.
3. Inputs are 1 through 9 as you can see
1 | 2 | 3 |
4 | 5 | 6 |
7 | 8 | 9 |
4. No inputs are duplicated
5. if no one wins after the tictac toe, print out "draw"
Example of screen of output
In: Computer Science
This question need to be solved using java coading :-
I. Input All input data are from a file "in.dat". The file contains a sequence of infix form expressions, one per line. The character '$' is an end mark. For example, the following file has four infix form expressions: 1 + 2 * 3 ^ ! ( 4 == 5 ) $ 3 * ( 6 - 4 * 5 + 1) + 2 ^ 2 ^ 3 $ 77 > ( 2 - 1 ) + 80 / 4 $ ! ( 2 + 3 * 4 >= 10 % 6 ) && 20 != 30 || 45 / 5 == 3 * 3 $ Each expression is a sequence of tokens (i.e., constant integers, operators, and end mark) separated by spaces. There is no variable. II. Output Output data and related information are sent to the screen. Your program should do the following for each expression: (1) printing the expression before it is manipulated; (2) showing the converted postfix form expression; (3) showing the expression tree; (4) printing the fully parenthesized infix form expression; (5) reporting the value of the expression. III. Operators The following operators are considered. They are listed in the decreasing order of precedence. Token Operator Associativity ! logical not right-to-left ^ exponentiation right-to-left * / % multiplicative left-to-right + - additive left-to-right < <= > >= relational left-to-right == != equality left-to-right && logical and left-to-right || logical or left-to-right IV. Other Requirements Since a large amount of information are to be displayed on the screen, it is mandatory for your program to provide users a prompting message such as Press <Enter> to continue ... after each expression is processed, so that users have the chance to check the output of your program carefully. V. Algorithm: Infix_to_postfix conversion Input: An infix form expression E = t1 t2 t3 ... $, which is a sequence of tokens. Output: The postfix form expression of E. Algorithm: { do { get the next token t; case (t) { operand: place t onto the output; break; operator: while (stack s is not empty && stacktop(s) is not a left parenthesis) && precedence(stacktop(s)) >= precedence(t) // assuming left-to-right associativity, // not for the exponentiation operator ^, // which has right-to-left associativity { pop(x,s); place x onto the output; } push(t,s); break; (: push(t,s); break; ): while (stacktop(s) is not a left parenthesis) { pop(x,s); place x onto the output; } pop(x,s); break; end mark: while (stack s is not empty) { pop(x,s); place x onto the output; } place the end mark onto the output; break; } } while (t is not the end mark); }
This below is "in.dat file"
12 * 23 <= ( ( ( 3456 ) ) + ( 6789 ) ) $
1
4 ^ 3 - ( 2 + 4 * 15 ) - ( 90 / 3 != 30 ) $ 2
! ( 222 < 111 ) + 2 * 3 ^ ( 29 - 3 * 9 ) > 18 && 1234
== 1234 $ 1
( 2 * ( 62 % 5 ) ) ^ ( ( 4 - 2 ) ) - 2 ^ 2 ^ 2 $ 0
( ( 9 / ( 5 - 2 ) + 2 ) * ( 2 ^ 2 * 2 ) - 79 ) || ! ( 65432 >
54321 ) $ 1
( ( 9999 >= 8888 ) + 2 ) * ( 4 / ( 999 - 997 ) ) - 2 ^ ( 5 - 3 )
$ 2
In: Computer Science
6. A tromino is a group of three unit squares arranged in an
L-shape. In the following tiling problem, the input is an n by n
array of unit squares where n = 2k for some positive integer k,
with one forbidden square in the array. You want to generate a
tiling of the array satisfying the following conditions: (a) every
square other than the forbidden square is covered by a tromino
(this means that the forbidden square is not covered); (b) no two
trominos overlap; and (c) no tromino extends beyond the array.
Design a divide-and-conquer algorithm that solves the tiling
problem.
In: Computer Science