Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
First, launch NetBeans and close any previous projects that may be open (at the top menu go to File ==> Close All Projects).
Then create a new Java application called "ECommerceApp" (without the quotation marks) whose main method follows the pseudocode below, and whose other methods are as specified below.
Print the banner message
Get the products catalog String
Get the product order from the user and check it exists in the products catalog String
If the product exists Get the product price Compute the product tax Compute the total sale
Output the total sale Else Output "The product was not found."
Get the products catalog String
Get the product order from the user and check it exists in the products catalog String
If the product exists Get the product price Compute the product tax Compute the total sale
Output the total sale Else Output "The product was not found."
Your program must include the following methods:
- A method called bannerPrinter that takes no parameter and has no return value. bannerPrinter outputs a greeting to the command line as shown below.
******************************************
====== Welcome to my eCommerce app! ======
******************************************
(print a blank line after the banner) - A method called productsBuilder that takes no parameters and returns a String. In the method body construct a String (name it productsCatalog) and populate it with items, each of which must be 10 characters long. For any product less than 10 characters, pad the remainder with spaces. You don't need to get the values from the user, just populate the String with 3 product names. For example, product 1 might be "Desk ", product 2 might be "Table ", and product 3 might be "Pen ". All 3 of these products are within the productsCatalog String.
- A method called getOrder that takes a String as a parameter (the productsCatalog String) and returns a boolean. In the method body, first display the productsCatalog String to the user. Then prompt the user to enter a product name (a String), and check whether the product name exists in productsCatalog. If it exists, return true, otherwise return false.
- A method called getPrice that returns a double. In the method body generate a random number between 1 and 100 (Hint: See Horstmann Section 4.9.2.) and return this value as the price.
- A method called getTax that takes a double as a parameter (the price) and returns a double. Compute the return value as 10% of the parameter value (i.e. 10% of the price). This is the tax.
- A method called getTotal that takes two doubles as parameters (the price and the tax) and returns a double. The return value is computed as the sum of the two parameters (the return value is the sale total).
- A method called printTotal that takes a double as a parameter (the sale total) and has no return value. This method outputs the following to the command line: "Your sale total is: $X" where X is the sale total parameter value.
All currency amounts that your program outputs should show a leading "$" followed by the whole number, a decimal, and two decimal positions.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 4 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Create an application named SalesTransactionDemo that declares several SalesTransaction objects and displays their values and their sum. The SalesTransaction class contains the following fields: Name - The salesperson's name (as a string) salesAmount - The sales amount ( as a double) commission - The commission (as a double) RATE - A readonly field that stores the commission rate (as a double). Define a getRate() accessor method that returns the RATE Include three constructors for the class. One constructor accepts values for the name, sales amount, and rate, and when the sales value is set, the constructor computes the commission as sales value times commission rate. The second constructor accepts a name and sales amount, but sets the commission rate to 0. The third constructor accepts a name and sets all the other fields to 0. An overloaded + operatoradds the sales values for two SalesTransaction objects and returns a new SalesTransaction object. In order to prepend the $ to…arrow_forwardPls help ASAP.arrow_forwardPython GUI tkinter: Using tkinter create a GUI that displays the word cat. The user clicks on the word and sees its synonyms as replacements. When the user selects a desired synonym the synonym replaces the original word. For example: cat The user clicks on that word and has these options listed in a listbox: animal friend companion The user clicks on animal so the GUI now says: animalarrow_forward
- For this lab, you will be doing the following in C#: 1) Create a Home form with buttons that when clicked, will open the Account, Email, and eventually the Contact forms. The Account form should be opened in "View" mode. 2) Add code to the Login form so the Account form opens when the user clicks "Create New Account". The Account form should be opened in "Modify" mode. 3) Add code to the Login form that validates the user input before allowing the user the access the Home form. For now, just verify the user enters "user1" and "12345" for the username and password respectively.arrow_forwardFinish the JTVDownload application which allows a user to select one of at least five television shows to watch on demand. When the user selects a show, display a brief synopsis. Include an editable combo box and allow the user to type the name of a television show and display an appropriate error message if the desired show is not available. JTVDownload.javaimport javax.swing.*;import java.awt.*;import java.awt.event.*;public class JTVDownload extends JFrame implements ItemListener {JComboBox<String> programBox = new JComboBox<String>();JLabel programList = new JLabel("*** Program List ***");JLabel stars = new JLabel("*****************************");JTextField descripField = new JTextField(20);String[] progs = {"Breaking Bad","Orange is the New Black", "Twilight Zone","Parks and Recreation", "Everybody Loves Raymond"};String[] descrips = {"", "Teacher becomes meth dealer","Life in women's prison","Classic science fiction episodes","Comedy in local government…arrow_forwardFirst, launch NetBeans and close any previous projects that may be open (at the top menu go to File ==> Close All Projects). Then create a new Java application called "IncomeTax" (without the quotation marks) that prompts a user for his or her marital status (single or married) and annual income (a double value), and then uses nested if statements to compute that person's tax, based on the simplified tax-rate table below. Output of your program should look close to the following and should be constructed using both String literals and variables for income, tax rate, and income tax. Based on a status of "single" and an annual income of $10000.00,the income tax is 15.00% of $10000.00, which equals $1500.00.Simplified Tax-Rate Table Income Marital Status - Single Marital Status - Married <= $30,000 15% 12% > $30,000 25% 20% Thoughts Note the requirement for this program to use nested if statements. This requirement is intended to help you build some…arrow_forward
- For this Mini-project, you need to create an application that allows the user to input two decimal numbers. The application should also have buttons that allow the user to request that the numbers are added, subtracted, multiplied, or divided. In addition, give an option to complete all 4 calculations or to clear the input and output (i.e., reset the page to its starting state). The program is written in C# in Visual Studio using the Web Form Design. Thank you!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_forwardA private int data field named accountNum for the account (default 0). A private string data field named accountName for the account (default "none"). A private double data field named balance for the account (default 0). A private int data field named numTransactions that will count the number of deposit and withdraw transactions made to an account. A private Date data field named dateCreated that stores the date when the account was created. A no-arg constructor that creates a default account. A constructor that creates an account with the specified account number and name. The accessor and mutator methods for account number, name. The accessor method for balance and dateCreated. A method named withdraw that withdraws a specified amount from the account. A method named deposit that deposits a specified amount to the account. A method named displayAccountInfo that displays all the information in the Account object. A method named combine that takes another Account object as an…arrow_forward
- In the langauage R: Which of the following statements is NOT correct about themes in R? Select one: Once set, a theme applies to all subsequent plots and remains active until it is replaced by a different theme The theme_set() function takes the name of a theme as an argument If we want to change the overall look of the figure all at once, we can use ggplot’s theme engine The theme_minimal() function can make ggplot output look like it has been featured in the Wall Street Journalarrow_forwardCreate a JavaFx application which calculate and add default gratitude (tips) to the a table bill and show the relevant information Business rules : • default 10% gratitude • table between 8 to 15: 15% gratitude • table more that 15: 20% gratitude The following information needed to be displayed on the designed application Table Total: $ 1000 Number of guesses: 20 Total Gratitude: $200 Sub Total: $ 1200 Tax (13%): $ 156 Payable: $1356 *** Make sure to apply any necessary validation you see fit for this application to avoid crashing your application *** validation messages may indicated on the window (stage) or pop out as an Alert() You may use any layout which you see fit.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education