You has been requested to design and develop a food ordering system based on following requirements:
The system shall allow the user to place an order for the food(s), view the food details, modify or delete the details of the food if necessary. Your program should be menu driven, giving the user various choices. You shall design the system by demonstrating the full understanding of object-oriented and use of list/link-list concept.
For every food order, the following information will be stored: Order ID (Auto assigned, unique ID), Food Code, flavor (example: Strawberry, chocolate), weight (Kg), Unit Price, Qty and customer information who order this cake. The customer information consists of customer ID, name, address and contact number. The order ID shall be automatically assigned with a unique ID when new order is added. The system shall display additional information that is amount (unit price * qty) when viewing the order details.
*in C++ language .
In: Computer Science
Root is a trie that has characters for values. When traversed it spells words by formin strings.
I'm trying to make findNode such that it will return the node at which we start collecting candidates for words that start with a specific prefix.
How do I code this method traversing depth-first?
my code:
private static TreeNode<Character> findNode(TreeNode<Character> root, String prefix, int index){
Stack <TreeNode<Character>> s = new Stack<>();
s.push(root);
for(TreeNode<Character> child : root.getChildren()){
while(index <= prefix.length()-1){
if(prefix.charAt(index) == child.getValue()){
index++;
findNode(child, prefix, index);
if(prefix.charAt(index) != child.getValue()){
return child;
}
}
}
}
}
In: Computer Science
Problem 3.
Let G be the grammar we saw in homework 3:
E -> E + T | E - T | T
T -> T * F | F
F -> ( E ) | x | y
Let w be (x + y) * x - y
a) Show the leftmost derivation for w in G. Number the rules for G and show the corresponding rule number under each substitution arrow in the derivation.
Hint: it may be easier to create a parse tree first, as you did in homework 3
b) Convert G to a string-pushing PDA, call it DG; show a transition diagram for DG. There will be one reduce transition for each terminal symbol in G and one shift transition for each rule in G.
Label all transitions in DG as follows:
Ti and Tf for the initial and final transitions
Rc for a reduce transition that reads terminal symbol c
Sk for a shift transition that corresponds to rule numbered k in G
c) Show an accepting computation for w in DG as a table. This table will one row per transition, and 4 columns: remaining input, current state, stack contents, and next transition. For example, the first row in your table will be (w, q0, e, Ti)
Hint: use your derivation from part (a) to help you choose the shift transitions
In: Computer Science
Would anyone know how to code this in SQL? I can't quite figure it out.
The following drop command is inserted for convenience so that if you need to recompile your code, it will drop the table
DROP TABLE Orders Cascade constraints
DROP TABLE OrderLine CASCADE CONSTRAINTS;
-- CREATE TABLE Orders
(
ordernum INTEGER PRIMARY KEY,
priority CHAR(10) NOT NULL,
cost INTEGER NOT NULL, /*
IC1: The priority is one of: high, medium, or low */
>>
/* IC2: The cost of a high priority order is above 2000. */
>>
/* IC3: The cost of a medium priority order is between 800 and 2200 (inclusive). */
>>
/* IC4: The cost of a low priority order is less than 1000. */
>>
Thank you in advance!
In: Computer Science
II. Answer the following questions accordingly:
1. What is meant by the concept of management myths.
2. Explain the incremental model with respect to its features, advantages and disadvantages.
3. Discuss the term engineering with respect to the term generic process framework.)
4. List and explain any three (3) umbrella activity under the software framework.
In: Computer Science
In: Computer Science
In: Computer Science
1. What is meant by the concept of management myths.
2. Explain the incremental model with respect to its features, advantages and disadvantages.
3. Discuss the term engineering with respect to the term generic process framework.
4. List and explain any three (3) umbrella activity under the software framework.
1. Assume that you are a software engineer. A client is asking you to develop a mobile application to manage the data in his mobile, with an advanced feature such as accepting voice as an input. However he still needs your help to identify other possible features. What is the most suitable process model?
2. Mr. X wants an integrated Information System for his Car Company. He knows that the scope of the system is huge but wants it as soon as possible. He is willing to pay for the software for as long as all the subsystems are complete and delivered on time. If you are the software engineer, what process model will you use?
In: Computer Science
C++ EXERCISES
(a) Given int a = 5, b = 2, c = 4, and d = 5; determine the value of the expression:
d % b * c > 5 || c % b * d < 7.
(b) Which repetition statement is preferred for user data input and its validation?
(c) Write a for statement to populate an array, double val[NUMCOUNT], for the following case: Use a counter named double count that has an initial value of 16.2, a final value of 0.4, and a decrement of 0.2 and populate the val[] array with the value of count.
What is the size, NUMCOUNT, of the array val[]?
In: Computer Science
Write an if statement that uses the turtle graphics library to determine whether the turtle’s pen color is red or blue. If so, set the pen size to 5 pixels.
Python.
In: Computer Science
In most organizations, a long list of “to-do” projects for
development exists. Since each organization only has limited staff
and financial resources to accomplish the long list of IT project
it is important to know how to identify, classify and select which
projects will be undertaken.
Describe what occurs during project identification, classification
and selection. Why can this process be challenging at times?
In: Computer Science
IN JAVA
Lab 10
This program reads times of runners in a race from a file and puts them into an array. It then displays how many people ran the race, it lists all of the times, and if finds the average time and the fastest time.
In BlueJ create a project called Lab10
Text File: times1.txt
12.4321 23.543 10.23 16.342 21.12
Text File: times2.txt
14.473 17.5 21.178 11.8 9.874 18.71 19.801 14.310 20.7 12.78 9.915 11.789
main method to be used for lab
import java.util.Scanner;
import java.io.File;
import java.io.FileNotFoundException;
public class Main
{
public static void main(String [] args)
{
//DO NOT CHANGE MAIN
double average;
double fastest;
double [] times;
times = new double[50];
int numRacers;
numRacers = fillArray(times);
System.out.println("\nThere were " + numRacers + " people in the race ");
// Hint: You may want to comment out the following lines of code until you
// get the method fillArray to work (use the debugger to check if it is
// working. Then uncomment the next method call you are implementing and
// get that to work. Do one method at a time.
System.out.println("\nThe times were: ");
printTimes(times, numRacers);
average = findAverage(times, numRacers);
System.out.printf("The average time was: %.2f%n", average);
fastest = findFastest(times, numRacers);
System.out.printf("The fast time was: %.2f%n", fastest);
}
public static int fillArray(double [] array)
{
int numElems = 0;
Scanner keyboard = new Scanner(System.in);
String fileName;
System.out.print("Enter the file name: ");
fileName = keyboard.next();
// Part A
// Declare a input file Scanner and link it to the filename the user
// typed in. Make sure the file opens correctly and if it doesn't print
// and error message to the screen and exit the program.
// Part B
// Code the loop that will read in the numbers from the file and put them
// into the array. The integer numElems should keep track of how many numbers
// are being placed into the array
// Part C
// Close the file
// Part D
// return the number of elements in the array
}
public static void printTimes(double [] array, int numElems)
{
// Part E
// Write the loop to print the array to the screen as shown
}
public static double findAverage(double [] numbers, int numE)
{
// Part F
// Write the code required to calculate the average of all of the
// numbers in the array The method should return the average. If
// there are no elements in the array it should return a -1
}
// Part G
// Write the method to find the fastest time in the array. The method
// should return the fastest time. If there are no times in the array
// the method should return a -1
}
Sample Output 1
Enter the file name: times1.txt
There were 5 people in the race
The times were:
12.43
23.54
10.23
16.34
21.12
The average time was: 16.73
The fast time was: 10.23
Sample Output 2
Enter the file name: times2.txt
There were 12 people in the race
The times were:
14.47
17.50
21.18
11.80
9.87
18.71
19.80
14.31
20.70
12.78
9.92
11.79
The average time was: 15.24
The fast time was: 9.87In: Computer Science
Write code:
using R to combine two pictures into one picture and save it. For example put imagin1.png into image2.png and save it as imagin3.png.
In: Computer Science
Create a basic functioning Deep Belief Network coding using C++ or MATLAB.
In: Computer Science
Express the binary strings in the left column of the following table in hexadecimal notation in the right column of the table.
|
Binary string |
Binary string expressed in hexadecimal notation |
|
1111000011110000 |
|
|
1010111010101110 |
|
|
1111000111011111 |
|
|
11110000110110001101 |
|
|
10001100111011111000 |
Add the bit strings in the first two columns of the following table and report the answer in the last column in binary notation.
|
Bit string 1 |
Bit string 2 |
Result of the addition in binary notation |
|
111101 |
111110 |
|
|
100010 |
110011 |
|
|
111011 |
101111 |
|
|
110001 |
100001 |
|
|
1111101 |
1001111 |
In: Computer Science