Please answer true or false for each statement.
1. An attribute that is a foreign key cannot have a null value.
2.The Excel spreadsheet’s data model is set-theoretic.
3.A candidate key is a property of a database that must always be unique for all relations in the database.
4. A table in Microsoft’s Access must have at least one column.
5. In the relational model, a relation schema is a set of tuples.
In: Computer Science
Program 1-100 integer accumulation using RISC-V assembly.
Note: RARS only simulates 320-bit instructions of RISC-V, so make sure you use the instruction that operate work-size data type (mostly with `w` as the last character of the instruction mnemonic)
In: Computer Science
(Linked Lists)
The Problem
UCF is growing so large that they’re actually starting a mini-supermarket, KnightsMart, stocked with typical supermarket products along with all the studying essentials (selection of coffees and creamers, pallets upon pallets of Red Bull, and all the Twinkies you can imagine!).
KnightsMart is in need of a program that:
Throughout any given day, the following things can occur (just as in a normal store):
For this program, you will need to maintain three linked lists: a linked list of all products in the store, a linked list of products that need to be reordered, and a linked list of sales that occur on any given day.
You will read in a list of commands from an input file, and your program will execute those commands accordingly. The final command, for each day, will be one that prints out a summary for all sales in the given day, which is detailed in the input/output specifications.
Implementation
You will need to make use of the following structures (EXACTLY as shown):
typedef struct KnightsMartProduct {
int itemNum; char itemName[21]; double unitPrice; int stockQty; int restockQty;
struct KnightsMartProduct *next;
} KMProduct;
typedef struct KnightsMartRestockProduct {
int itemNum;
struct KnightsMartRestockProduct *next;
} KMRestockProduct;
typedef struct KnightsMartSale { char firstName[21];
char lastName[21];
int numItemsOnList; // # of items on shopping list int *itemsPurchased; // array of item numbers
struct KnightsMartSale *next; } KMSale;
You will need to make the following three linked lists:
KMRestockProduct node is made, and it is immediately added to the end of this list.
Input File Specifications
You will read in input from a file, "KnightsMart.in". Have this AUTOMATED. Do not ask the user to enter “KnightsMart.in”. You should read in this automatically. (This will expedite the grading process.). The first line of the file will be an integer, d, representing the number of days that the simulation will run. The first line of each simulation will be an integer, k, indicating the number of commands that will be run for that day’s simulation, with each command occurring on a separate line. Each of those k commands will be followed by relevant data as described below (and this relevant data will be on the same line as the command).
The commands you will have to implement are as follows:
◦ You need to traverse the list using the method shown in class.
◦ For every product (node) in this KMRestockList list, you need to search for that item in the KMproducts list, which will allow you to restock that node accordingly.
◦ Once found, you will increase the stockQty member of that KMProduct based on the restockQty member of that same KMProduct.
◦ You then need to delete that particular product (node) from the KMRestockList. Note: since you delete from the KMRestockList as you traverse the list, this means that you will simply be deleting from the front of the list at all times. ◦ Assuming you follow these steps properly, once you’ve traversed the entire
KMRestockList, restocked all necessary products, and then deleted those products from the KMRestockList, at this point KMRestockList will have no nodes and should point to NULL (meaning, the list is empty).
As mentioned previously, a purchase occurs when a customer finds, and of course then buys, one of the items on their shopping list. When this happens, a KMSale node must be made, which records this sale. The struct members must then be filled in accordingly. One member of the KMSale node is itemsPurchased. This is an array that must be dynamically allocated based on the size (number) on the original shopping list. If the product is found and purchased, the item number is added to the corresponding cell of this array, along with the quantity purchased. We assume that if the stock for a given item is available, the customer will purchase the full desired quantity on their shopping list (of that item). If the product is not found, a zero is recorded in that cell of the array. Based on the three-item example above, if the first and third items were available, with the second being unavailable (no stock), the itemsPurchased array would have SIX cells as follows: 5437, 2, 8126, 0, 9828, 4. This shows that 2 units of 5437 were purchased, and 4 units of 9828 were purchased; the zero after item 8126 simply shows that the item was not available. Finally, once all appropriate information is saved into the struct members of the KMSale node, this node is then added to the end of the KMSales list. Note: a line of output is printed regardless of whether or not a purchase was made. Refer to sample output for examples.
◦ You need to traverse the list using the method shown in class.
◦ For every Sale (node) in the KMSales list, you need to print Sale number (starting at 1), along with the first and last name of the customer (in that order). You then need to print the list of items that were successfully found and then purchased. Finally, you need to print the total amount paid. Please refer to the EXACT output format for specifics.
◦ After printing the appropriate information, you then need to delete that particular Sale (node) from the KMSales list. Note: since you delete from the KMSales list as you traverse the list, this means that you will simply be deleting from the front of the list at all times. This also means that the first Sale (node) in the list will be both the first Sale printed and the first Sale deleted.
◦ Assuming you follow these steps properly, once you’ve traversed the entire KMSales list, printed all necessary information, and then deleted those Sales from the KMSales list, at this point the KMSales list will have no nodes and should point to NULL (meaning, the list is empty).
◦ Lastly, you must print out the total sales (dollar amount) for the given day.
Status of Lists at the end of each day:
At the end of each day, the KMSales list will clearly be empty, as per the description in the PRINTDAYSUMMARY command. This prints each Sale, deletes each node, effectively destroying that list. The other two lists, KMProducts and KMRestockList, will be maintained throughout the entire running of your program. Meaning, you clearly should not destroy (delete all nodes from) the list of products in the store at the end of a day, as this would result in there being no products in the store for subsequent days. Additionally, the
KMRestockList will also be maintained over the simulation. This means that if there were items in the KMRestockList at the end of a given day, those items will remain in that list at the beginning of the next day, thereby allowing them to be restocked whenever a REORDER command arrives.
Output Format
Your program must output to a file, called "KnightsMart.out". You must follow the program specifications exactly. You will lose points for formatting errors and spelling.
When examining the output file, you should notice that the INVENTORY command and the PRINTDAYSUMMARY command results in printing a “semi-formatted” line of text. To avoid guessing games and to guarantee the correctness of your format, we are providing those two print literals below:
Here is the literal for printing inventory items in the INVENTORY command:
"\t| Item %6d | %-20s | $%7.2lf | %4d unit(s) |\n"
And here is the literal for printing customer items in the PRINTDAYSUMMARY command:
"\t\t| Item %6d | %-20s | $%7.2lf (x%4d) |\n"
In: Computer Science
SQL allows duplicate tuples in relations, and correspondingly defines the multiplicity of tuples in the result of joins. Which of the following queries always gives the same answer as the nested query shown below?
select * from R where a in (select S.a from S);
select R.* from R,S where R.a = S.a; |
||
select R.* from R, (select distinct a from S) as S1 where R.a = S1.a; |
||
select R.* from R,S where R.a = S.a and is unique R; |
||
select distinct R.* from R,S where R.a = S.a; |
In: Computer Science
When writing code in any language, it is always a good idea to work in a modular fashion. In this approach you will write a small piece of code (usually a small logical module), and test to ensure it works. If it does, you will add more code, and test it again. This way, if the program were to crash after you last addition, you will know where to look for bugs. Debugging a few lines of code is much easier than typing pages of code and then trying to debug that. Please use this approach while working at your programming assignments.
In this assignment you will write a small program that demonstrates that you can manipulate a string. You can hardcode a string of your choice in your code, that is, create a variable and assign it a string "Mary had a little chicken". Then you will use string functions to manipulate it. Keep in mind that to test your program I will enter my own string into your code. So, your program has to work for all possible strings and produce correct output.
First, echo the string on the screen, and then print it
backwards using a string function. Figure out how to count the
total number of letters in the string using functions provided in
the chapter, and the number of vowels and consonants. For this
exercise, please treat letter "y" as a vowel. Your output should
look exactly like this:
Original string: Mary had a little
chicken
Reversed string: nekcihc elttil a dah yraM
Total letters: 21
Vowels: 8
Consonants: 13
Save your script as mystringyourlastname.php and submit to BB via submission portal before the deadline. Be sure to thoroughly test your code on xampp server with Internet Explorer and/or Firefox. I will be using xampp to test your submission. Test your assignment with various input strings to ensure it operates correctly. I will check different strings to make sure you have done error checking.
Please plan to have enough time for testing and debugging. I will nor be debugging your code for you. Please keep in mind that I ALWAYS read you code, so do not forget to format it nicely and use comments, as points will be deducted for such violations. Program that does not work will receive ZERO credit, as it is pointless to produce a program that does not work. Partial credit for depend on the existing functionality, per rubric below.
In: Computer Science
In Verilog
Design a state machine, using the D flip-flop, that implements a
00 and 11 sequence detector. Your machine should output a
1 as soon as it detects two 0s or
two 1s on its input, otherwise it outputs
0s.
Write a module that implements the machine and a test bench to test
it.
In: Computer Science
In: Computer Science
I. Malicious software can be classified by propagation method or payload. Explain the difference between the three common propagation methods: worm, virus and social engineering;
II. Explain the difference between a normal virus, a metamorphic virus and a polymorphic virus, including discussing how easy they are to detect by anti-virus software
In: Computer Science
System Design and Analysis
Analyze and design a hotel reservation system -
Should include the following
- Create a Data Flow Diargram that includes Context Diagram and
DFD 0
- Create a Use Case Diagram and include 8 fully-dressed use
cases.
In: Computer Science
Write a thesis with not less than 5000 word
Cloud services and its uses for good governance in Developing countries.
In: Computer Science
Suppose an algorithm A1 has a runtime T1(n) defined ( in seconds) by the following function
T1(n) = n3 + 20n + 15
For n = 13, the runtime of the algorithm is 2472 seconds. Let us assume that we have an algorithm A2 with runtime given by T2(n) = n2 + 22n + 14? What will be the lowest value of n for which the runtime of A2 exceeds 2472 seconds?
**Urgently needed**
In: Computer Science
Q1. under what circumstances would static hashing be better than extendible hashing?
Q2. under what circumstances would extendible hashing be better than static hashing?
In: Computer Science
In: Computer Science
Chapter 7, Problem 3PE from Introduction to Programming using Python by Y. Daniel Liang.
Problem
(The Account class) Design a class named Account that contains:
■ A private int data field named id for the account.
■ A private float data field named balance for the account.
■ A private float data field named annualInterestRate that stores the current interest rate.
■ A constructor that creates an account with the specified id (default 0), initial balance (default 100), and annual interest rate (default 0).
■ The accessor and mutator methods for id, balance, and annualInterestRate.
■ A method named getMonthlyInterestRate() that returns the monthly interest rate.
■ A method named getMonthlyInterest() that returns the monthly interest.
■ A method named withdraw that withdraws a specified amount from the account.
■ A method named deposit that deposits a specified amount to the account.
Draw the UML diagram for the class, and then implement the class. (Hint: The method getMonthlyInterest() is to return the monthly interest amount, not the interest rate. Use this formula to calculate the monthly interest: balance * monthlyInterestRate. monthlyInterestRate is annualInterestRate / 12. Note that annualInterestRate is a percent (like 4.5%). You need to divide it by 100.)
Write a test program that creates an Account object with an account id of 1122, a balance of $20,000, and an annual interest rate of 4.5%. Use the withdraw method to withdraw $2,500, use the deposit method to deposit $3,000, and print the id, balance, monthly interest rate, and monthly interest.
In: Computer Science