SSD3exercise1答案
and uses:
o Wrapper classes to read numerical data
o StringTokenizer to parse a line with multiple values
o Exceptions to handle malformed data
o Control structures to control the reading of data
Background
This assignment asks you to complete an application that adds products to an electronic shopping cart. The application uses three classes: Product, ShoppingCart, and ShoppingCartApplication. Part of the work has been done for you and is provided in the student archive. You will implement the method in ShoppingCartApplication that reads product information from the keyboard and creates a Product object. Description
The application presents the user with a menu of options and prompts the user for a choice:
Choice 0 terminates the program.
Choice 1 adds a product to the shopping cart.
Choice 2 displays the information of all the products stored in the shopping cart.
Choice 3 displays the total cost of all the products in the shopping cart.
To add a product, the user enters a line with the following format:name_quntity_price
Where:
name is the name of the product. quantity is the quantity of the product. price is the price of the product.
The fields are delimited by an underscore ( _ ). If the user's input is invalid, the application displays an error message.
The following is a screen shot of the application after some products have been added.
暂无评价 8页 免费 口译与听力exercise1-5 5页 2财富值 exercise1-3 暂无评价 8页 5财富值 ssd8 Exercise1 23页 5财富值...
ssd8 Exercise1 23页 5财富值 江苏省如皋市石庄初中八年... 暂无评价 3页 2财富值 exercise1 3页 8财富值 exercise1 2页 免费 exercise1 4页 5财富值...
exercise1-4 暂无评价 8页 免费exercise1 暂无评价0人阅读0次下载举报文档《C 语言程序设计》第一周练习 1. 编辑...
Exercises and keys 1.酶和一般化学催化剂相比,不具有的特点是 A.具有更强的催化效能 B.具有更强的专一性 C.催化的反应无副反应 D.可在高温下进行 E.是...
5页 2财富值 EXERCISE1-8 24页 免费 ssd8 Exercise1 23页 5财富值 Classroom Exercise1 6页 免费 SSD7 exercise1 3页 免费喜欢此文档的还喜欢...
5页 2财富值 EXERCISE1-8 24页 免费 ssd8 Exercise1 23页 5财富值 Classroom Exercise1 6页 免费 SSD7 exercise1 3页 免费...
exercise1_IT/计算机_专业资料。简单实用的C语言教程 附带一些习题和答案作业提交:2010cpro01@gmail.com 作业提交: 2010cpro02@gmail.com 2010cpro04@gmail.com ...
exercise 1 暂无评价
exercise 1_英语_初中教育_教育专区。Exercises I. Translate the following expressions: 1.cotton piece goods 棉布(业务) 2. state-operated co...
exercise1_初一英语_英语_初中教育_教育专区 暂无评价0人阅读0次下载举报文档 exercise1_初一英语_英语_初中教育_教育专区。初一英语练习...
热门文档