Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question
100%

Don't Copy from other website. 

ALL THREE ANSWER PLZ

Exercise 4

Import and edit the ShoppingCart02 project.

• Declare and initialize numeric fields:

– price (double)

– tax (double)

– quantity (int)

• Declare a double totalPrice:

– Assign a value, calculated from price , tax , and quantity.

Change message to include quantity:

– (example: “Alex wants to purchase 2 Shirts.”)

• Print another message showing the total cost.

Your program should produce a similar output:

Alex wants to purchase 2 Shirts

Total cost with tax is: $25.78

ShoppingCart02.java
package shoppingcart02;

public class ShoppingCart02 {
    public static void main(String[] args) {
        String custName = "Alex";
        String itemDesc = "Shirts";
        String message = custName+" wants to purchase a "+itemDesc;
        
        // Declare and initialize numeric fields: price, tax, quantity.   
        
        
        
        // Declare and assign a calculated totalPrice
        
        
        // Modify message to include quantity 
        
        System.out.println(message);
        
        // Print another message with the total cost
        
    }    
}
Exercise 5

Import and edit the Casting01 project

Casting01.java

package casting01;

public class Casting01 {
    public static void main(String[] args) {
        //Declare and initialize a byte with a value of 128
        //Observe NetBeans or eclipse complaint

        
        //Declare and initialize a short with a value of 128
        //Create a print statement that casts this short to a byte

        
        
        //Declare and initialize a byte with a value of 127
        //Add 1 to this variable and print it
        //Add 1 to this variable again and print it again

        
        
        
    }    
}
Exercise 6

Import and edit the Parsing01 project.

• Declare and initialize 3 Strings with the following data:

String Variable Description Example Values

shirtPrice Text to be converted to an int: "15"

taxRate Text to be converted to a double: "0.05"

gibberish Gibberish "887ds7nds87dsfs"

Parse and multiply shirtPrice*taxRate to find the tax.

– Print this value.

• Try to parse taxRate as an int.

– Observe the error message.

• Try to parse gibberish as an int.

– Observe the error message.

Parsing01.java
package parsing01;

public class Parsing01 {
    public static void main(String[] args) {
        //Declare and intitialize 3 Strings: shirtPrice, taxRate, and gibberish
        
        
        
        
        //Parse shirtPrice and taxRate, and print the total tax
        
        
        
        //Try to parse taxRate as an int
        
        //Try to parse gibberish as an int
        
    }
    
}

Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
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
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education