In: Computer Science
1. Superior Bake Shop sells a variety of baked goods online. Attributes of Baked Good include ProductID, ProductName, Product Category, Weight, and Price. Attributes of Customer include CustomerID, CustomerName, and CustomerAddress (composed of Street, City, State, and ZipCode). Customers place orders with Superior BakeShop. Attributes of order are OrderID and OrderDate. All customers have placed at least one order and customers may place many orders over time. Each order is placed by a single Customer. Orders can include one or more baked good. A baked good can be included in one or more order. Superior Bake Shop keeps track of the quantity of each baked good that is included in an order.
2. Blue Orchard Bake Shop (BOBS) offers a variety of baking workshop. BOBS keeps track of the workshops it offers as well as its teachers and students. Attributes of workshop include WorkshopID, Date, Time, and Fee. Attributes of teacher include TeacherID, TeacherName, (composed of FirstName, MiddleInitial, and LastName), PaymentPerWorkshop, and Skills. Many teachers have more than one skill. Attributes of student include StudentID, StudentName (composed of FirstName, MiddleInitial, and LastName), StudentAddress (composed of Street, City, State, and ZipCode), DateOfBirth, and Age. Students can participate in more than one workshop, but must participate in at least one workshop. Each workshop can have multiple students, but must have at least one student. All workshops are taught by a single teacher. Teachers can teach any number of workshops including zero in the case of a new teacher who has not yet offered a workshop.
3. Main Street Catering has residential, business, and school clients. Attributes of residential clients include ClientNumber, ClientName (composed of FirstName, MiddleInitial, and LastName), ClientAddress (composed of Street, City, State, and ZipCode), and NearestCrossStreets. For each residential client, the two nearest cross streets are stored. Attributes of business clients include ClientNumber, BusinessName, ClientAddress (composed of Street, City, State, and ZipCode), and AnnualCateringBudget. Attributes of school clients include ClientNumber, SchoolName, SchoolDistrictCode, and ClientAddress (composed of Street, City, State, and ZipCode). Some residential clients are also business clients, and some residential clients are also school clients. Main Street Catering has a few clients who are neither residential, nor business, nor school clients.
Draw a conceptual data model to model the scenario in each problem. Use the model constructs (e.g., the material on the E-R model and the enhanced E-R model) from chapters 2 and 3 as appropriate and follow the modeling conventions used in the example problems in the online lessons. Do not use the modeling conventions shown in Figure 2-22 of the Hoffer textbook which illustrate a data model in Visio notation. Be sure to include all appropriate completeness constraints, disjointness constraints, and subtype indicators in your conceptual data models.
In: Computer Science
Below are three methods: checkValidInput, getCoordinates and play. Looking at checkValidInput, I feel it is very longwinded and would like to modify by using a try/catch block for user input. How is this occomplised? Would I be able to get rid of checkValidInput method with a try/catch? Any code to help me out would be great.
public boolean checkValidInput(String input){
ArrayList<String> numList = new ArrayList<String>();
for (int i=0;i<10;i++){
numList.add(""+i);
}
String[] coordinates = input.split(" ");
//returns false if there are not 2 strings
if (coordinates.length!=2){
return false;
}
//returns false if first is String is not in between A and J
if(coordinates[0].charAt(0)<'A' || coordinates[0].charAt(0)>'J')
return false;
//returns false if the second string is not a single digit number
for (String str: coordinates[1]){
if (numList.contains(str)==false){
return false;
}
}
//returns false if the coordinates have already been shot at
int row = Integer.parseInt(coordinates[0]);
int column = Integer.parseInt(coordinates[1]);
if (this.availableSpot[row][column]==false){
return false;
}
return true;
}
public int[] getCoordinates(String input)
{
int[] coordinates = new int[2];
String[] strList = input.split(" ");
int row = (int) strList[0].charAt(0) - 65;
int column = Integer.parseInt(strList[1]);
coordinates[0] = row;
coordinates[1] = column;
return coordinates;
}
public void play()
{
print(101);
print(1);
ocean.randomShipDeployment();
boolean isGameOver = ocean.isGameOver();
sc = new Scanner(System.in);
//printOcean the ocean and start the game
ocean.printOcean();
print(3);
while (!isGameOver)
{
print(2);
String input = sc.nextLine();
//check if input is valid
while (!checkValidInput(input))
{
print(99);
input = sc.nextLine();
}
//get coordinates and fire
int[] coordinates = getCoordinates(input);
int row = coordinates[0];
int column = coordinates[1];
ocean.shotFiredAtLocation(row, column);
availableSpot[row][column] = false;
isGameOver = ocean.isGameOver();
ocean.printOcean();
print(3);
print(100);
}
//printOcean info saying you win
print(4);
print(5);
}In: Computer Science
C++ programming,How to remove element from string without using the string::erase() function ?
example:
input string:"cheasggaa"
element need to be removed:"ga"
output:"cheasga"
or:
input:"cekacssdka"
element:"ka"
output:"cecssd"
In: Computer Science
find and view several YouTube videos that discuss cloud security. identify the URLs of three videos that you think do a good job communicating essetial issues approches for cloud security. if you could only recommend one to fellow students, which would you pick? why? summrize your recomedations and justification in a brief paper
In: Computer Science
Using the IDLE development environment, create a Python script named tryme4.py. (Note: an alternative to IDLE is to use a free account on the pythonanywhere website: https://www.pythonanywhere.com/)
IDLE has both an interactive mode and a script mode. You must use the script mode to develop your script. Your script must use meaningful variable names and have comments that describe what is happening in your script. Comments may describe the assignment of a value to a variable, a computation and the assignment of the result to a variable, or the display of the result.
Write a function in this file called nine_lines that uses the function three_lines (provided below) to print a total of nine lines.
Now add a function named clear_screen that uses a combination of the functions nine_lines, three_lines, and new_line (provided below) to print a total of twenty-five lines. The last line of your program should call the function clear_screen.
The function three_lines and new_line are defined below so that you can see nested function calls. Also, to make counting “blank” lines visually easier, the print command inside new_line will print a dot at the beginning of the line:
def new_line():
print('.')
def three_lines():
new_line()
new_line()
new_line()
Submit your Python script file in the posting of your assignment. Your Python script should be either a .txt file or a .py file.
You must execute your script and paste the output produced into a document that you will submit along with your Python script.
It is very helpful if you print a placeholder between the printing of 9 lines and the printing of 25 lines. It will make your output easier to read for your peer assessors. A placeholder can be output such as “Printing nine lines” or “Calling clearScreen()”.
In: Computer Science
In the language c using the isspace() function: Write a program to count the number of words, lines, and characters when user enter statements as input. A word is any sequence of non-white-space characters.
Have the program continue until end-of-file. Make sure that your program works for the case of several white space characters in a row. The character count should also include white space characters.
Example of the user input could be the statement below:
You're traveling through
another dimension;
a dimension not only
of sight and sound,
but of mind.
In: Computer Science
The following tables form a Library database held in an RDBMS:
Borrower (card_no , last_name , first_name , address , city ,
state , zip )
Books (ISBN, title, pub_date , pub_id , list_price, category_id,
pub_id)
Categories (category_id, category_desc)
Author (author_id , last_name , first_name)
Bookauthor (ISBN, author_id)
Publisher (pub_id, name, contact, phone)
Bookloans (ISBN, branch_id, card_no , date_out, due_date)
Bookcopies (ISBN, branch_id , no_of_copies)
Branch (branch_id, branch_name, city)
Please use the standard join method, no implicit method
allowed.
Write SQL statements to perform the following queries:
1. Display the title of each book and the name and phone number of
the contact at the publisher’s office for reordering each book.
2. Which books were written by an author with the last name Steven? Perform the search using the author name.
3. Identify the authors of the books Leila Smith borrowed Perform the search using the borrower last name.
4. Display the most recent publication date of all books.
5. Display the list price of the least expensive book in the Computer Science category.
6. What’s the list price of the most expensive book written by Carlos Tim?
7. Display how many times each book title has been borrowed.
8. How many times has the book with ISBN “0401140733” been borrowed?
In: Computer Science
Create a html page to convert miles into kilometers, the page should have four buttons using FOR loop to convert values from 1-25, 25-50, 50-75, and 75-100
Upon clicking any of the four button, output should display the range miles to kilometers in table cell.
In: Computer Science
Write a C program.
Problem 1: You are given two sorted arrays, A and B, and A has a large enough buffer at the end to hold B. Write a method to merge B into A in sorted order without using any other array space. Implementation instruction: (1) Define one array of size 18 for A and the other array of size 5 for B. (2) Initialize A by inputting 13 integers in the ascending order, and Initialize B by inputting 5 integers in the ascending order. (Note: don’t hard code the integers of the arrays.) (3) Merge B with A in a way all values are sorted. (4) Print out the updated array A, after merging with B. For example: If your input for A is 1, 3, 11, 15, 20, 25, 34, 54, 56, 59, 66, 69, 71 and your input for B is 2, 4, 5, 22, 40 Finally, after merging A and B, A becomes 1, 2, 3, 4, 5, 11, 15, 20, 22, 25, 34, 40, 54, 56, 59, 66, 69, 71
In: Computer Science
In Java:
Implement a program that directs a cashier how to give change. The program has two inputs: the amount due and the amount received from the customer.
Display the dollars, quarters, dimes, nickels, and pennies that the customer should receive in return. In order to avoid roundoff errors, the program user should supply both amounts in pennies (for example 274 instead of 2.74).
In: Computer Science
Please use Java only.
Write the class TopResult, which keeps track of the best (highest numbered or highest ordered) result it has seen so far. The class will be a generic type, so the type of results it sees depends on how it is declared.
TopResult Task:
There are a number of situations in which we want to keep track of the highest value we've seen so far - a highest score, a most recent entry, a name which is closest to the end (or the front) of a list, etc. We can imagine writing a simple class which will do this: a class which will let us enter new results one by one, and at any point will let us stop and ask for the highest value.
So far, so good, right? But what if we have a number of different applications for this sort of class - for example, we want to find the top (integer) score on a test, or the highest (decimal) temperature reading, or the GUI window which is closest to the top, etc. Subclassing isn't quite the way to go here, because a TopResult which holds Integers isn't an instance of a TopResult which holds Doubles, and vice versa. But simply writing a class for every possible type we may need may seem like overkill, since the structure of the code is essentially the same from class to class.
In situations such as these, generics come to our rescue. When we define a generic class, the data type we use is essentially represented as a wildcard - a generic type parameter, which we can call T for instance. We write the class assuming that we have a type T in mind, with the idea that we will fill in the type once we know what it is. This is how an ArrayList is implemented, for example. It is a dynamic array of some generic type T, and the exact type is decided (specialized) when we declare the ArrayList variable, for example ArrayList<String> a. If we write our entire class in terms of this unkown type parameter, we will be able to simply name the type later when we want to use it.
In this exercise, we will write the class TopResult. It will have a generic type parameter (you can call it T or something else). Type T must be a Comparable type (thus, the full generic type parameter would be <T extends Comparable<T>>).
A Comparable is an interface which is implemented by classes such as Integer, Double, Character, and String, which allow two members of the same type to be compared to one another to see which is larger. The interface has one method, compareTo, which returns a negative, zero, or positive result indicating whether the object is less than, equal to, or greater than the object it is being compared against:
> Integer three = 3, four = 4;
> three.compareTo(four)
-1
> four.compareTo(three)
1
> four.compareTo(four)
0
The TopResult task should implement the following public methods:
The following shows an example use of this class:
> TopResult<Integer> tr = new
TopResult<Integer>();
> tr.getTopResult() // no results seen yet, should be null
null
> tr.newResult(7);
> tr.getTopResult()
7
> tr.newResult(3);
> tr.getTopResult()
7
> tr.newResult(4);
> tr.getTopResult()
7
> tr.newResult(9);
> tr.getTopResult()
9
> tr.newResult(20);
> tr.getTopResult()
20
> tr.toString() // this will print the toString() of the current
top result
"20"
Please make sure that it passes the following: https://repl.it/@micky123/SweetEmotionalExtraction
Please be sure that the work is your own, not a duplicate of somebody else's. Thank you.
In: Computer Science
13. (6 point) when a downcast is necessary what would be the problem if the downcast was not done? Use an example in your explanation.
14. (6 point) The following code is from the ColorViews in-class example. what is the purpose of the function ? what the base class for the type the function is found in? How is it called?
override func draw(_ rect: CGRect)
{
// Get the context being draw upon
let context = UIGraphicsGetCurrentContext( )
//Create layer, if necessary
checkDrawLayer (context)
…
In: Computer Science
I have this projegt I will use asp.net wHAT PART CAN USE TO COMPLETE THE PROGET
For this project in the (Advanced Computer Networks) course, you may pick a system/language you like, design the project, implement it, and write a project report about it.
This project is related with the Readers and writers. Two types of users, Readers and Writers, can access a shared file. The file is allowed to be read by many readers simultaneously, but to be written by a single writer at a time when no reader is reading.
In this project, you are asked to solve the readers and writers problem by using the clientserver model and a kind of communication facility. Your program consists of several clients (readers and writers), a file access authorization server, and a shared file bank server. Clients may read/write different files or share a single file.
Before a client being able to access a file from the shared file bank server, it must first communicate with the authorization server to get a ticket (an encrypted permission which can be decrypted only by the shared file bank server). The file access authorization server receives requests from clients and manipulates up to N different files. The request message involves the following fields: the ID of the client, the type of the request (R/W), and the name of the file that the client wants to access. A transaction of accessing a file from a client is as follows:
• send REQ Message: request to the authorization server
• block_receive: waiting for a ticket
• send read/write (data) and ticket: request to the file bank server
• block_receive: waiting for data or ACK
• send REL Message: release to authorization server
• loop for certain times
You should test your program by different cases. For example, suppose your system manipulate five files A, B, C, D and E. One possible test case is to start with 30 clients that randomly access (with 30 percent of writers) a randomly selected file. Each client repeat 100 times. You should design at least 5 different test cases and you should use at least 3 computers to run your project.
Project Report: the report is a short report (2-4 pages) for what your project will be. It should contain a problem description and motivation, a description of the design of your solution, a description of your implementation, and an evaluation of how well your system solved the original problem.
In: Computer Science
Problem Description:
Problem Description:
Write a program that obtains the execution time of Selection sort, Insertion sort, Merge sort for input size 50000, 100,000, 150,000, 200,000, 250,000, and 300,000. Your program should create data randomly and print a table like this:
|
Array Size |
Selection sort |
Insertion sort |
Merge sort |
|
50000 |
|||
|
100000 |
|||
|
150000 |
|||
|
200000 |
|||
|
250000 |
|||
|
300000 |
|||
|
2000000 |
|||
|
3000000 |
|||
|
4000000 |
(Hint: You can use the code template below to obtain the execution time.)
long startTime = System.currentTimeMillis();
perform the task;
long endTime = System.currentTimeMillis();
long executionTime = endTime - startTime;
Analysis:
(Describe the problem including input and output in your own words.)
Coding: (Copy and Paste Source Code here. Format your code using Courier 10pts)
Name the public class Exercise18_29
Testing: (Describe how you test this program)
In: Computer Science