Toggle navigation
Help
Preferences
Sign up
Log in
Advanced
Prutt05 Tentamen
1
/
12
Actions
Remove this presentation
Flag as Inappropriate
I Don't Like This
I like this
Remember as a Favorite
Share
Share
About This Presentation
Title:
Prutt05 Tentamen
Description:
Prutt05 Tentamen. Model Answers. Note that many variations are possible to obtain full marks. ... The user clicks on an item and selects 'purchase' option. ... – PowerPoint PPT presentation
Number of Views:
39
Avg rating:
3.0/5.0
Slides:
13
Provided by:
karlm
Tags:
tentamen
|
flash
|
free
|
online_training
|
powerpoint
|
ppt
|
pptx
|
presentation
|
slide_show
|
slideshow
more
less
Transcript and Presenter's Notes
Title: Prutt05 Tentamen
1
Prutt05 Tentamen
Model Answers
Note that many variations are possible to obtain
full marks.
2
Q1.
0,1
1
1
Shopping_Cart
List_of_Item
totalPricefloat
Item purchase
1
totalDiscountfloat
clubMemberbool
Add(Item purchase)
Delete(Item purchase)
itemCountint
Delete( )
Add(Item purchase)
Delete(Item purchase)
Item
Delete( )
Pricefloat
checkout( )
DiscountOnPricefloat
ShoppingCart(Item purchase )
QuantityInt
Book
Clothing
DVD
authorString
sizeInt
artistString
titleString
descriptionString
titleString
MensClothing
WomensClothing
ChildrensClothing
3
Q1.(iii)
Add(Item purchase)
if (purchase.Quantity gt0)
this.theItemList.add(purchase)
purchase.Quantity--
this.itemCount
if (purchase instanceOf Clothing
clubMember1)
(purchase instanceOf Book clubMember2)
(purchase instanceOf DVD clubMember3)
this.totalPrice ( purchase.Price -
purchase.DiscountOnPrice)
else this.totalPrice purchase.Price
else
// throw an exception OutOfStock error?
// of Add()
4
Q2.(i)
Precondition user has entered the web site. No
shopping cart exists yet.
Actors end_user
Scenario
The user clicks on an item and selects purchase
option.
A new ShoppingCart object is created, and its
List_Of_Item component is initialised to contain
the purchase.
Repeated any finite number of times
2.a The user clicks on an item and selects the
purchase option. The item is added to the
ShoppingCarts List_Of_Item attribute. OR
2.b The user clicks on an item in the
ShoppingCart and selects the delete option. The
item is deleted from the ShoppingCarts
List_Of_Item attribute.
3.a. The user clicks on the checkout button,
OR
3.b The user clicks on the empty shopping cart
button.
Postcondition User has placed an order and
shopping cart is deleted, or else no order and
shopping cart is empty but still exists.
5
Shopping_Cart
List_Of_Item
ShoppingCart(purchase)
Alt
Add(purchase)
Add(purchase)
Delete(purchase)
Delete(purchase)
Alt
Checkout()
Delete()
Delete()
6
Q4
import junit.framework.TestCase
public class Shopping_Cart_Test extends TestCase
private Shopping_Cart testCart
private Book testBook new Book(Title1,
Author1, 10.99, 1.00, 10)
// 10 copies in store at 10.99 each, discount
1.00
private Book testBook2 new Book(Title2,
Author2, 11.99, 2.00, 20)
// 20 copies in store at 11.99 each, discount
1.00
protected void setUp()
testCart new Shopping_Cart() // no items
clubMember2 True
testCart.addItem(testBook) // setup with a
first item
protected void tearDown() // not needed
7
Q3.
For such a small project XP or COTS would seem to
be the best models. There
seems to be no room for large documentation.
However both these approaches
will satisfy any bank needs for project
visibility. Study the course notes further to
appreciate the consequences of these two choices.
Consider also the many
disadvantages of the spiral model and waterfall
model in this case. Lastly, rapid
prototyping doesnt seem necessary here, as the
product is quite well understood.
(We may even be able to buy most of it off the
shelf!).
8
Public void testAdd() // add an item and then
check its there
testCart.addItem(testBook2)
assertEquals(testCart.totalPrice, 9.99 9.99)
assertEquals(testCart.itemCount, 2)
assertEquals(testCart.totalDiscount, 2.00
1.00)
assertEquals(testBook2.getQuantity(), 19)
// testBook2 is still in the cart
Public void testDelete(Item purchase) throws
ItemNotFoundException
// delete an item and check its gone i.e. back
in store
testCart.delete(testBook2)
assertEquals(testCart.totalPrice, 9.99)
assertEquals(testCart.itemCount, 1)
assertEquals(testCart.totalDiscount, 1.00)
assertEquals(testBook2.getQuantity(), 20)
9
Public void testDeletItemNotInCart() // try to
delete a non-existent item,
// is this possible via the user interface?
Maybe?
try
private Book testBook3 new Book(Title3,
Author3, 10.99, 1.00, 10)
testCart.delete(testBook3)
fail(Should raise an ItemNotFoundException)
catch (ItemNotFoundException e) //passes the
test
public void testDelete() // empty the cart and
it should be empty!
testCart.delete()
assertEquals(testCart.itemCount, 0)
assertEquals(testCart.totalPrice, 0.0)
10
Q5.
ltDOCTYPE Shopping_Cart
lt!ELEMENT Shopping_Cart (Shopper, Book, DVD,
Clothes)gt
lt!ATTLIST Shopping_Cart totalPrice REQUIREDgt
lt!ATTLIST Shopping_Cart totalDiscount REQUIREDgt
lt!ATTLIST Shopping_Cart itemCount REQUIREDgt
lt!ATTLIST Shopping_Cart dvdMember (TRUEFALSE)
FALSEgt
lt!ATTLIST Shopping_Cart bookMember (TRUEFALSE)
FALSEgt
lt!ATTLIST Shopping_Cart clothingMember
(TRUEFALSE) FALSEgt
lt!ELEMENT Book (Title, Author)gt
lt!ELEMENT Title (PCDATA)gt
lt!ELEMENT Author (PCDATA)gt
lt!ATTLIST Book Price REQUIREDgt
lt!ATTLIST Book DiscountOnPrice REQUIREDgt
lt!ATTLIST Book Quantity REQUIREDgt
11
lt!ELEMENT DVD (Title, Artist)gt
lt!ELEMENT Title (PCDATA)gt
lt!ELEMENT Artist (PCDATA)gt
lt!ATTLIST DVD Price REQUIREDgt
lt!ATTLIST DVD DiscountOnPrice REQUIREDgt
lt!ATTLIST DVD Quantity REQUIREDgt
lt!ELEMENT Clothing (Style, Size, Description)gt
lt!ELEMENT Style (PCDATAMensClothingWomensClothi
ngChildrensClothing)gt
lt!ELEMENT Size (PCDATAXSSMLXL)gt
lt!ELEMENT Description (PCDATA)gt
lt!ATTLIST Clothing Price REQUIREDgt
lt!ATTLIST Clothing DiscountOnPrice REQUIREDgt
lt!ATTLIST Clothing Quantity REQUIREDgt
12
lt?xml version1.0 encodingUTF-8?gt
ltShopping_Cart totalPrice11.99, itemCount1,
totalDiscount1.00,
dvdMemberTRUE, bookMemberTRUE,
clothesMemberTRUEgt
ltBook price11.99, discount_On_Price1.00,gt
ltTitlegtMyTitlelt/Titlegt
ltAuthorgtMyAuthorlt/Authorgt
lt/Bookgt
lt/Shopping_Cartgt
Q6. The problem here is that item prices need to
be synchronised. If this is done
then it is not possible for cusomers to access
them while they are being changed.
If they are not synchronised then race can
occur, which leads to the
phenomenon described in the question. Study the
course notes in order to
appreciate how to make changes to the code.
Write a Comment
User Comments (
0
)
Cancel
OK
OK
Latest
Latest
Highest Rated
Sort by:
Latest
Highest Rated
Page
of
Recommended
Recommended
Relevance
Latest
Highest Rated
Most Viewed
Sort by:
Recommended
Relevance
Latest
Highest Rated
Most Viewed
Related
More from user
«
/
»
Page
of
«
/
»
CrystalGraphics Presentations
Introducing-PowerShowcom
- Introducing-PowerShowcom (Without Music)
CrystalGraphics 3D Character Slides for PowerPoint
- CrystalGraphics 3D Character Slides for PowerPoint
Chart and Diagram Slides for PowerPoint
- Beautifully designed chart and diagram s for PowerPoint with visually stunning graphics and animation effects. Our new CrystalGraphics Chart and Diagram Slides for PowerPoint is a collection of over 1000 impressively designed data-driven chart and editable diagram s guaranteed to impress any audience. They are all artistically enhanced with visually stunning color, shadow and lighting effects. Many of them are also animated. And they’re ready for you to use in your PowerPoint presentations the moment you need them. – PowerPoint PPT presentation
Related Presentations
Meettechniek 13 november 2006
- University of Twente, Department of Electrical Engineering ... theorems on electrical sources. Vo open voltage. Ik short circuit current. Zg source impedance ...
| PowerPoint PPT presentation | free to view
BK8030|40 Ways to study hto schakel September 2005
- Tentamen = elaborating 20 take home assignments on your own website ... Composers like Chopin, painters like Rembrandt and architects like Le Corbusier ...
| PowerPoint PPT presentation | free to view
Docenten:
- P.P. Koets, STO 0.40, tel 4954; P.P.Koets@tue.nl ... Tijdens het tentamen mogen boek & aantekeningen worden geraadpleegd. Overzicht Tentamenstof ...
| PowerPoint PPT presentation | free to view
BIVAOMC 2004 College 8 291004
- Leg de betekenis uit aan de hand van een handelsbedrijf en een advocatenkantoor. ... VEEL PLEZIER TE WENSEN BIJ DE VOORBEREIDING EN HEEL VEEL SUCCES BIJ HET TENTAMEN ! ...
| PowerPoint PPT presentation | free to view
IL2206 Embedded Systems http:www.ict.kth.secoursesIL2206
- Course home page on the webb. Registration to the course. Schedule ... Tentamen. 4. Nios IDE (rep) I/O: polling/interrupt. Performance: Processor and Memory ...
| PowerPoint PPT presentation | free to view
Meettechniek 13 november 2006
- Inleiding practicum. 1. University of Twente, ... tentamen. Voorkennis. Preambule practicum. H10 (lezen) (voor proef A) LVDT in het kort (voor proef C) ...
| PowerPoint PPT presentation | free to view
Ber
- Ber kningsvetenskap Michael Thun Simulering Ber kningsvetenskap Ber kningsvetenskapliga fr gest llningar Block 2: Line ra ekvationssystem Att kunna efter ...
| PowerPoint PPT presentation | free to view
Mr P.C. Slangen
- Mr P.C. Slangen Projectleider Schakelzone Recht Presentatie door: Projectorganisatie Schakelzone Stuurgroep prof. mr. A.F.M. Dorresteijn, prof. dr H. Spoormans, dr. W ...
| PowerPoint PPT presentation | free to view
Elektromagnetisme
- ... (for scientists and Engineers) Giancoli -Chapter 3 en 21 t/m 31- Te ... integralen # 2 Electrostatics: ... erg minimaal) # 21 Electric Charge ...
| PowerPoint PPT presentation | free to view
Datateknik A, Informationss
- Datateknik A, Informationss kerhet och riskanalys, 7,5 hp Videolektion 1: Introduktion till kursen N gra begrepp som beh vs inf r lab 1 och 2.
| PowerPoint PPT presentation | free to view
Neurale Netwerken
- Title: hc 6: Multilayer Nets and Backpropagation Author: Joris IJsselmuiden Last modified by: Joris IJsselmuiden Created Date: 4/8/2005 5:04:18 PM
| PowerPoint PPT presentation | free to view
2IV10 Computergrafiek set 1-inleiding
- Title: PowerPoint Presentation Last modified by: jwijk Created Date: 1/1/1601 12:00:00 AM Document presentation format: On-screen Show (4:3) Other titles
| PowerPoint PPT presentation | free to view
Makroekonomi med till
- Title: Chapter 5: Goods and Financial Markets: The IS-LM Model Subject: Macroeconomics, 3/e, Blanchard Author: Fernando Quijano and Yvonn Quijano
| PowerPoint PPT presentation | free to view
Niet meer zenuwziek van de statistiek, maar
- Title: BreaEmbedding statistics in a research context: some effects Author: Hans van Buuren Last modified by: aho Created Date: 4/16/2004 5:46:24 AM
| PowerPoint PPT presentation | free to view
Mechanica
- Title: PowerPoint Presentation Last modified by: mulders Created Date: 1/1/1601 12:00:00 AM Document presentation format: On-screen Show Other titles
| PowerPoint PPT presentation | free to view
KRIZNA I URGENTNA STANJA U PSIHIJATRIJI
- KRIZNA I URGENTNA STANJA U PSIHIJATRIJI Doc. dr. sc. Dra en Begi Klinika za psihijatriju KBC Zagreb DEFINICIJE POJMOVA Stresor Stres Krizno stanje (kriza) Krizna ...
| PowerPoint PPT presentation | free to view
Hang je poppetje
- Title: PowerPoint Presentation Last modified by: Hogeschool van Amsterdam Document presentation format: On-screen Show Company: Sanne 't Hooft Other titles
| PowerPoint PPT presentation | free to view
Computer Ondersteunde ZELFSTUDIE
- Title: PowerPoint-presentatie Author: Hans Welleman - CITG Last modified by: Hans Welleman - CITG Created Date: 1/1/1601 12:00:00 AM Document presentation format
| PowerPoint PPT presentation | free to view
Chemie I
- Chemie I Contact Dit document is samengesteld door onderwijsbureau Bijles en Training. Wij zijn DE expert op het gebied van bijlessen en trainingen in de exacte ...
| PowerPoint PPT presentation | free to view
Trillingen (oscillaties)
- slinger in versneld systeem : effectieve valversnelling willekeurig object: hoekversnelling gegeven door koppel en traagheidsmoment: Harmonische oscillator en ...
| PowerPoint PPT presentation | free to view
Propedeuse ? Ondernemen
- Title: V2, marketing Author: Hogeschool van Amsterdam Last modified by: Hogeschool van Amsterdam Created Date: 9/8/2004 2:05:40 PM Document presentation format
| PowerPoint PPT presentation | free to view
Elektromagnetisme
- ... Potentiaal vergelijkingen De Poisson en Laplace vergelijkingen Karakteristieke eigenschappen ... 11th international edition Young & Freedman Inhoud Wet ...
| PowerPoint PPT presentation | free to view
AI Kaleidoscoop
- ... , Structures and strategies for complex problem solving Luger (5th edition ... 4U 1R 2D 1L 7U 6R 8D 1 2 3 4 5 6 7 8 Boter-kaas-en-eieren Vier-op-een ...
| PowerPoint PPT presentation | free to view
Statistiek II
- Statistiek II Deel 1 Dit college Cursusinformatie Indeling werkgroepen Overzicht stof Herhaling (kort of lang?) Gemiddelde en variantie T-toetsen Anova versus t-toets ...
| PowerPoint PPT presentation | free to view
Computer Networks
- ... Forouzan, Data ... cooperative interconnection of networks that supports a universal communication service ... Data communications and networking ...
| PowerPoint PPT presentation | free to view
Neurale Netwerken
- Title: hc 6: Multilayer Nets and Backpropagation Author: Joris IJsselmuiden Last modified by: Joris IJsselmuiden Created Date: 4/8/2005 5:04:18 PM
| PowerPoint PPT presentation | free to view
Lars Br
- Mail : wynllars@tele2.se Mobil : 070 - 5140406 Arbetsformer, planering, examination Varf r IEK ? Tidigare erfarenhet ? Kursens inriktning : Styrning och beslut.
| PowerPoint PPT presentation | free to view