Sunday, January 17, 2010

2003 Mondeo Outside Temperature Sensor

Progetto per l'appello del 27 gennaio

Abstract

Read all instructions! In particular paragraphs mode and recommendations.

Introduction

is required to implement a program that allows you to view in the form of histogram data on the points scored by players on a basketball team, in a simplified manner.

Job Description The program should display a graphical user interface containing at least 3 buttons and two text areas. Figure 1 illustrates a possible appearance of the interface. The program window is resizable and components must be scaled automatically when the user changes the window size .
La GUI
Figure 1

When the user clicks on the "View Players", the program must read from a text file number of players that make up the team, reading from another text file the names of the players and see the names of the players read the text area on the left. For example, if the file contains the number of players

 10 

and the file contains the names of the players

 
Dino
Cino Gino Lino

Mino

Nino Pino Rino

Tino Vino

user interface appears as shown in Figure 2.

La GUI con i nomi dei giocatori
Figure 2

Then when you click on the "View Points", the program must read a third text file the points scored by each giocatore e visualizzare un istogramma "verticale" (non orizzontale) con la somma dei punti segnati da ogni singolo giocatore. Anche il terzo file deve essere un file di testo (ossia visualizzabile da linea di comando e creabile/modificabile con un
editor di testo), e deve avere un formato predefinito: su ogni linea, deve comparire il nome del giocatore, uno spazio e il tipo di canestro segnato (da 1, 2 o 3 punti).

Ad esempio, un possibile file di punti è il seguente:

 Gino 1 
Dino 1
Lino 2
Gino 1
Mino 3
Mino 1
Nino 2
Pino 1
Rino 1
Gino 3
Vino 1
Gino 2
Gino 2
Gino 1
Tino 2
Gino 1
Nino 2
Mino 2
Dino 2
Rino 3
Gino 1
Gino 1
Gino 1
Gino 1
Gino 1
Gino 1

che porta a un istogramma come quello illustrato in figura 3.

La GUI con l'istogramma
Figura 3

I nomi dei tre file vanno passati al programma sulla linea di comando secondo questa sintassi:

 java NomeProgramma FileConNumeroGiocatori FileGiocatori FilePunti 

Si noti che i singoli canestri rappresentati nel file dei punteggi vanno sommati giocatore per giocatore per ottenere i valori da visualizzare nell'istogramma; nell'esempio, questi valori sono:

 Cino 0 
Dino 3
Gino 17
Lino 2
Mino 6
Nino 4
Pino 1
Rino 4
Tino 2
Vino 1

Si noti anche l'area di testo a destra usa un font monospaziato per la visualizzazione corretta dell'istogramma. Fate riferimento alla classe java.awt.Font . Anche il metodo java.lang.Integer.parseInt(String) vi potrebbe essere molto utile…

Il pulsante "Esci" serve, ovviamente, a chiudere la finestra e terminare l'esecuzione del programma.

Il programma deve essere composto almeno delle seguenti classi:

  • GUI (con eventuali classi interne per gli ascoltatori. Potete comunque implementare gli ascoltatori anche come classi "normali".)
  • Istogramma (con un metodo toString )
  • Giocatore
  • Progetto

L'interfaccia mostrata in figura è solo una delle molte possibili implementazioni, che viene fornita solo per esempio, e che quindi siete liberissimi di modificare. Potete anche apportare delle migliorie.

Modalità

Il livello di complessità del programma prodotto può essere deciso liberamente dagli studenti; ovviamente, progetti più articolati e complessi otterranno una valutazione migliore di progetti più semplici, ma si consiglia di fare "poco e bene" piuttosto che "tanto e male" : progetti semplici possono comunque ottenere il massimo punteggio, purché ben fatti (leggete bene le raccomandazioni !). La durata prevista del lavoro, considerando un gruppo di 3 persone che lavorano a tempo pieno, è di una settimana al massimo.

Il progetto va realizzato assolutamente in gruppi di 3 persone e tutti i componenti di un gruppo devono conoscere tutti i dettagli del progetto, come se l'avessero realizzato da soli.
Progetti realizzati da gruppi di meno o più persone non verranno valutati . In caso di difficoltà nel trovare compagni è possibile mandare una email ai docenti che provvederanno ad assegnare i compagni mancanti. L'unica eccezione this rule applies to students enrolled as workers still need to ask permission first teachers via email. Without authorization, the project will not be assessed.

Prepared by a short report, preferably (but not necessarily) in XHTML + CSS, on the work. The report must contain:

  1. A brief analysis of the problem and an intuitive description of the specifications (less than 2 pages!).
  2. Any simplifications made compared to the full request (few lines). Obviously, the simplifications will lead to lower valuations. Moreover, the simplifications should be adequately motivated.
  3. Additions (Things no longer required, eg use of components dell'AWT not explained in class, use of Swing, adding features not required, add menus, etc.. Etc...) The reasons for
  4. all your choices (for example, because you have made a simplification, because you have decided to use some graphical components and not others, why you made certain design choices rather than others, and so on).
  5. The complete listing of the program, with comments, written in monospaced font, that is not proportional ( like this: "i" and "m" occupy the same width ) and lined up properly ("indented").
  6. A "trial run" (about 3 pages) explaining how the program works: an explanation with text and illustrations of how the program works (appearance of the user, such as implementing inadequately explained, etc.).

The project must be delivered without fail by the beginning of the written appeal, which is January 27, 2010 at 9:00 am, both in printed form (one copy) or via e-mail (2 copies, one for teacher addresses: coppola@uniud.it and mizzaro@dimi.uniud.it ). It requires a single message:

  • with the subject "Project Planning"
  • contenente nel corpo i nomi dei componenti del progetto e,
  • in allegato ("attach"), in un unico file compresso (ad es. zippato), la relazione, il codice sorgente (i file ".java") e il bytecode (i ".class").

Il progetto in forma cartacea può essere consegnato a mano subito prima del compito scritto oppure può essere consegnato nei giorni precedenti lo scritto direttamente a uno dei docenti o nella casella della posta del dipartimento di matematica e informatica.

NOTA Questo progetto è valido per chi intende sostenere l'appello del 27 gennaio, 3 febbraio 2010), e va quindi consegnato entro la scadenza del 27 gennaio ore 9:00 (inizio della written test). Will not be accepted late for any reason. For subsequent calls will be set up other projects.

Recommendations

contribute to the evaluation of various aspects of project (relevance of the simplifications made, relationship quality, etc..), But it is a priority program of the quality product, especially as regards the characteristics of readability , modifiability ... Examples of criteria for evaluation

  • The program works?
  • resistant to errors of interaction with the user?
  • You are able to make small changes in behavior without rewriting a lot of code?
  • The GUI is resizable (ie: you have not used setResizable (false) )? And then you can use on screens of different sizes?
  • Did you use the layout manager?
  • The code is written correctly, and have followed the principles of structured programming, Object Oriented and concealment of information?
  • The code is commented? There are enough comments? There are too many comments? Comments are not discounted? The three types of comments in Java have been used correctly?
  • You have respected the conventions on the names of identifiers in Java? The report
  • è chiara?
  • Le variabili d'istanza e di classe non possono essere ridefinite come variabili locali?
  • ecc. ecc.

Altre raccomandazioni:

  • Non dichiarate una variabile se poi la usate una sola volta. Potete sicuramente scrivere un programma analogo senza quella variabile.
  • Non copiare scriteriatamente il codice trovato su Internet: chiunque può scrivere su Internet e non è detto che sappia cosa sta facendo.
  • Evitate al massimo setPreferredSize . Piuttosto pensate ad un layout che funzioni con qualsiasi dimensione sensata.
  • Evitate commenti del tipo x = 2; //assegno 2 a x : qualunque programmatore sa cosa vuol dire x=2; !!
  • Non usate static solo perché il compilatore dà errore. Usatelo solo se serve veramente.
  • Limitate al massimo l'uso delle variabili d'istanza e di classe, preferite le variabili locali ai metodi.
  • Non usate public solo perché il compilatore dà errore. Usatelo solo se serve veramente.

Per eventuali dubbi rivolgersi ai docenti, o durante l'orario di ricevimento o per posta elettronica.