C design an application that declares an array of 10

This preview shows page 6 - 10 out of 15 pages.

We have textbook solutions for you!
The document you are viewing contains questions related to this textbook.
Java Programming
The document you are viewing contains questions related to this textbook.
Chapter 1 / Exercise 5
Java Programming
Farrell
Expert Verified
c. Design an application that declares an array of 10 StockTransactions. Promptthe user for data for each of the objects, and then display all the values.
We have textbook solutions for you!
The document you are viewing contains questions related to this textbook.
Java Programming
The document you are viewing contains questions related to this textbook.
Chapter 1 / Exercise 5
Java Programming
Farrell
Expert Verified
Programming Logic and Design, 7eSolutions 10-7output “Enter stock symbol ”input stockSymoutput “Enter stock name ”input nameoutput “Enter price ”input pricetrans.setStockSymbol(stockSym)trans.setStockName(name)trans.setPricePerShare(price)return transvoid display(StockTransaction trans)output “Stock Transaction data”output “Stock symbol: ”, trans.getStockSymbol()output “Name: ”, trans.getStockName()output “Price: ”, trans.getPricePerShare()return7.Complete the following tasks:a. Design a class named Pizza. Data fields include a string field for toppings (such as pepperoni) and numeric fields for diameter in inches (such as 12) and price (such as 13.99). Include methods to get and set values for each of these fields. Create the class diagram and write the pseudocode that defines the class.
Programming Logic and Design, 7eSolutions 10-8returnpublic void setDiameter(num size)diameter = sizereturnpublic void setPrice(num price)this.price = pricereturnpublic string getToppings()return toppingspublic num getDiameter()return diameterpublic num getPrice()return priceendClassb. Design an application that declares two Pizzaobjects and sets and displays their values.
Programming Logic and Design, 7eSolutions 10-9

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture