Computer Networking: A Top-Down Approach (7th Edition)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Bartleby Related Questions Icon
Related questions
Question
Using the getSales() function as a reference, create a function thatt will take one parameter (string code) which is a product code (or part thereof), and when the search button is pressed, all sales that include this product code (or part thereof) will be displayed in the jTable. The date boxes in the GUI will be replaced with a text box. The schema of the database where the queries are being used is also attached.
public List<Pos> getSales(String fromDate, String toDate){
List<Pos> salesList = new ArrayList<>();
try {
String query = "SELECT sales_date, sales_number, prod_code, prod_name, unit_cost, quantity, sales_total "
+ "FROM Sales, SalesDetails, Product "
+ "WHERE Sales.sales_number = SalesDetails.sales_number "
+ "AND SalesDetails.prod_code = Product.prod_id "
+ "AND sales_date BETWEEN ? AND ?";
PreparedStatement stmt = conn.prepareStatement(query);
stmt.setString(1, fromDate);
stmt.setString(2, toDate);
ResultSet rs = stmt.executeQuery();
while (rs.next()) {
String salesDate = rs.getString("sales_date");
int salesNumber = rs.getInt("sales_number");
String prodCode = rs.getString("prod_code");
String prodName = rs.getString("prod_name");
double unitCost = rs.getDouble("unit_cost");
int quantity = rs.getInt("quantity");
double salesTotal = rs.getDouble("sales_total");
Pos pos = new Pos(salesDate, salesNumber, prodCode, prodName, unitCost, quantity, salesTotal);
salesList.add(pos);
}
} catch (SQLException ex) {
System.out.println(ex.getMessage());
}
return salesList;
}
Transcribed Image Text:Sales Finder Screen
Sales date from:
2021年03月09日
Sales Date
2021年03月15日
2021年03月15日
2021年03月15日
2021年03月20日
2021年03月20日
2021年03月20日
2021年03月20日
2021年03月20日
2021年03月21日
Sales date to:
2021年03月23日
Sales Number Product Code
4 4225
4
9813
4 3700
5 4225
5 9813
5 3700
6 5486
6 6097
7 4225
Search
Product Name
Cheese Feta
Wine Muscadet Sur Lie
Compound - Rum
Cheese Feta
Wine Muscadet Sur Lie
Compound Rum
Plasticknivesblack
Sage Ground Wiberg
Cheese Feta
Price
21.77
34.1
32.15
21.77
34.1
32.15
11.08
16.49
21.77
Qty
15
7
2
10
15
4
12
6
5
Total
X
326.55
238.7
64.3
217.7
511.5
128.6
132.96
98.94
108.85
Transcribed Image Text:swen2005 sales
SalesNumber: int(10)
SalesDate : date
# Sales Total : decimal(7,2)
V swen2005 salesdetails
number: int(10)
# SalesNumber : int(10)
C prodid: varchar(20)
# price : decimal(7,2)
# qty: int(10)
swen2005 products
number : int(11)
prodid: varchar(20)
C prodname : varchar(30)
# price : decimal(10,2)
#onhand int(11)
Expert Solution
Check MarkThis question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
bartleby
Step by stepSolved in 3 steps
Knowledge Booster
Background pattern image
Similar questions
- In this project you will implement a student database using JavaFX. A GUI should be used as the program's interface. This program must consist of two classes. (1) The first class should define the GUI and handle the database interactions: a. Combo box should allow the user to select one of the four database actions (Insert, Delete, Find, and Update). b. The database should be implemented as a HashMap, with the ID field as the key and a student record consisting of a name and major as the value. c. The operation should be performed when the user clicks the Process Request button. d. If the user attempts to insert a key that is already in the database an error message should be displayed using a JOptionPane message dialog box. e. If the user attempts to delete, find or update a record that is not in the database, a message should also be displayed. f. After each successful operation is completed a JOptionPane window should be...arrow_forward//The tostring method is not returning proper results //Please Use C# using System;using System.Collections.Generic; namespace DocumentStore.Question // remove semi colon from here and put starting { and ending } at the end of the code{ /// <summary>/// ! IMPORTANT !/// The following conditions must be satisfied:/// - The documents property show return the contents of the documents store./// This content should be readonly, ensure that there is no way to edit the data./// - The `AddDocument(string document)` function should add a new document to the store./// If the store is full, an InvalidOperationException should be thrown./// - The ToString() function should return the document store's description in the format of /// "Document store: number of documents/capacity"/// For example: if the store contains 1 document, and the capacity is 2, the expected output is:/// "Document store: 1/2" /// - If a document is a duplicate, it will be ignored...arrow_forwardplease write in C++.arrow_forward
- The code given below represents a saveTransaction() method which is used to save data to a database from the Java program. Given the classes in the image as well as an image of the screen which will call the function, modify the given code so that it loops through the items again, this time as it loops through you are to insert the data into the salesdetails table, note that the SalesNumber from the AUTO-INCREMENT field from above is to be inserted here with each record being placed into the salesdetails table. Finally, as you loop through the items the product table must be update because as products are sold the onhand field in the products table must be updated. When multiple tables are to be updated with related data, you should wrap it into a DMBS transaction. The schema for the database is also depicted. public class PosDAO { private Connection connection; public PosDAO(Connection connection) { this.connection = connection; } public void...arrow_forwardLook at the code below and use the following comments to incdicate the scope of the static variables or functions. Place the comment below the relevant line. Module scope Class scope Function scope The code runs. Use onlinegdb.com to see it run. Module scope means global but only known in this source file. Class scope means global but only known by the class. Function scope means global but only known in the function. Hide Comments 1 #include 2 static const int MAX_SIZE=10; 5 // Return the max value 6 static double max(double d1) 7 { static double lastMax = 0; lastMax = (di> lastMax) ? di : lastMax; return lastMax; 8 10 11 } 12 13 // singleton class only one instance allowed 14 class singleton 15 { public: static Singleton& getsingleton() { return theone; } // Returns the Singleton 16 17 18 19 20 friend std::ostream& operator<< (std::ostream& o, const Singleton& s); private: Singleton() { }; // Prevents more instances 21 22 23 24 25 static Singleton theone; 26 }; 27 Singleton...arrow_forwardastfoodStats Assignment Description For this assignment, name your R file fastfoodStats.R For all questions you should load tidyverse, openintro, and lm.beta. You should not need to use any other libraries. suppressPackageStartupMessages(library(tidyverse)) suppressPackageStartupMessages(library(openintro)) suppressPackageStartupMessages(library(lm.beta)) The actual data set is called fastfood. Continue to use %>% for the pipe. CodeGrade does not support the new pipe. Round all float/dbl values to two decimal places. All statistics should be run with variables in the order I state E.g., "Run a regression predicting mileage from mpg, make, and type" would be: lm(mileage ~ mpg + make + type...) To access the fastfood data, run the following: fastfood <- openintro::fastfood Create a correlation matrix for the relations between calories, total_fat, sugar, and calcium for all items at Sonic, Subway, and Taco Bell, omitting missing values with na.omit(). Assign the...arrow_forward
- For this assignment, you are to use the started code provided with QUEUE Container Adapter methods and provide the implementation of a requested functionality outlined below. Scenario: A local restaurant has hired you to develop an application that will manage customer orders. Each order will be put in the queue and will be called on a first come first served bases. Develop the menu driven application with the following menu items: Add order Next order Previous order Delete order Order Size View order list View current order Order management will be resolved by utilization of an STL-queue container’s functionalities and use of the following Queue container adapter functions: enQueue: Adds the order in the queue DeQueue: Deletes the order from the queue Peek: Returns the order that is top in the queue without removing it IsEmpty: checks do we have any orders in the queue Size: returns the number of orders that are in the queue While adding a new order in the queue, the program...arrow_forward3. Which among the following shows a valid use of the Direction enumeration as a parameter to the moveCharacter function? Select al that apply. enum Direction { case north, south, west, east}func moveCharacter(x: Int, y: Int, facing: Direction) {// code here} moveCharacter(x: 0, y: 0, facing: .southwest) moveCharacter(x: 0, y: 0, facing: Direction.north) moveCharacter(x: 0, y: 0, facing: .south) moveCharacter(x: 0, y: 0, facing: Direction.northeast)arrow_forwardmy_games = ['Zelda', 'Pokemon', 'Splatoon'] my_games[1] = 'Minecraft' Draw (or describe) the objects and labels that the Python interpreter creates in response to the first assignment. Then draw (or describe) the objects and labels that results from carrying out the second assignment immediately after the first assignment. Include your drawings or text descriptions in the solution document.arrow_forward
- Task Class Requirements The task object shall have a required unique task ID String that cannot be longer than 10 characters. The task ID shall not be null and shall not be updatable. The task object shall have a required name String field that cannot be longer than 20 characters. The name field shall not be null. The task object shall have a required description String field that cannot be longer than 50 characters. The description field shall not be null. Verify with Juint testing as wellarrow_forwardplease use java to answer the following questionarrow_forwardJQuery loading Consider following code $(function(){ // jQuery methods go here... }); What is the purpose of this code with respect to JQuery ? O This is to prevent any jQuery code from running before the document is finished loading (is ready). O This is to load the jQuery and to run this as soon as page start before loading. This is to load the function so we can run jQuery codearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Text book imageComputer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONText book imageComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceText book imageNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Text book imageConcepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningText book imagePrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationText book imageSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY
Text book image
Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON
Text book image
Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science
Text book image
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning
Text book image
Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning
Text book image
Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education
Text book image
Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY