Document information
- University
- Politecnico di Milano
- Degree programme
- Computer Engineering
- Subject
- Ingegneria del Software
- Material language
- Italian
- Classification
- Exam · Full exam
- Content
- Exam paper only
- Original format
- Text
- Searchable text
Study material for Ingegneria del Software, shared by the Studwiz community and reviewed by moderators.
Study material for Ingegneria del Software, shared by the Studwiz community and reviewed by moderators.
Import quality: text was extracted directly from the original document.
Representative passages recognised in different parts of the material. The full extracted text remains available to search, while this compact preview makes the page easier to read.
Ingegneria del Software — Soluzione del Tema 18/01/2021 Esercizio 1 Per incentivare l’uso di carte e app di pagamento, il governo ha definito un piano di rimborso per gli utenti che ne fanno uso. Un utente ha diritto a un rimborso normale (normal cashback) se effettua almeno 50 transazioni: il rimborso `e del 10% delle spese effettuate fino a un massimo di 150 euro. I 100000 utenti che effettuano pi `u transazioni hanno anche diritto a un rimborso super (super cashback) di 1500 euro. In caso di utenti con lo stesso numero di transazioni, si privilegiano gli utenti per cui la prima transazione effettuata `e pi `u vecchia. Si assume che due transazioni non possono mai essere perfettamente contemporanee. Si consideri la classeTransactionsDB che definisce un database di transazioni ai fini di monitorare il piano di rimborsi. Il database utilizza la classe pura Transaction di cui sono riportati i metodi pi`u rilevanti. p u b l i c c l a s s T r a n s a c t i o n s D B{ / / @ensures ( * A g g i u n g e l a t r a n s a z i o n e , l a n c i a n d o una N u l l P o i n t e r E x c e p t i o n s e e ’ n u l l a * ) p u b l i c v o i d a d d T r a n s a c t i o n ( T r a n s a c t i o n t ) ; / / @ensures ( * \ r e s u l t e ’ l a l i s t a d i t r a n s a z i o n i e f f e t t u a t e da u I d i n o r d i n e c r o n o l o g i c o * ) p u b l i c / *@ p u r e @ * / L i s t<T r a n s a c t i o n> u s e r T r a n s a c t i o n s ( U s e r I d uId ) ; / / @ensures ( * \ r e s u l t == ammontare d e l r i m b o r s o n o r m a l e p e r u I d * ) p u b l i c / *@ p u r e @ * / f l o a t normalCashBackFor ( U s e r I d uId ) ; / / @ensures ( * \ r e s u l t == ammontare d e l r i m b o r s o s u p e r p e r u I d * ) p u b l i c / *@ p u r e @ * / f l o a t superCashBackFor ( U s e r I…
First page of the document.