Documente Academic
Documente Profesional
Documente Cultură
7
1. Faza de Colectare a Cerinţelor.
Scopul lucrării
Verificare Verificare
Specificaţie
Verificare
Planificare
Verificare
Design
Verificare
Implementare
Testare
Integrare
Testare
Mod operare
Dezvoltare
Retragere
Mentenanţă
Verificare Verificare
Planificare
Verificare
Proiectare
Verificare
Implementare
Verificare
Integrare
Testare
Mod operare
Retragere
Dezvoltare
Mentenanţă
import java.io.*;
import java.util..*;
/
***************************************************
************************
*
* Clasa InvestmentRecord
*
/
***************************************************
***********************/
class InvestmentRecord {
public String number;
public String name;
public float ret;
public Date date;
} // InvestmentRecord
/
***************************************************
************************
*
* Clasa MSGPrototypeApplication
*
/
***************************************************
***********************/
class MSGPrototypeApplication {
public static void main (String args[]) {
MSGPrototype thisApplication = new
MSGPrototype ();
thisApplication.initialize ();
thisApplication.clearScreen ();
thisApplication.mainMenu ();
} // main
} // MSGPrototypeApplication
/
***************************************************
************************
*
* Clasa MSGPrototype
*
/
***************************************************
***********************/
class MSGPrototype {
public static final int NUM_RECORDS = 11;
/
***************************************************
************************
*
* Fiindcă aceasta este un prototip rapid o matrice de
înregistrări au fost utilizate.
* În implementarea finală va fi necesară o structură de date
dinamică,
* fiindcă nu este clar câte investiţii vom avea.
*
/
***************************************************
***********************/
//----------------------------------------------------------------------------
-----------------------------------
//----------------------------------------------------------------------------
-----------------------------------
//----------------------------------------------------------------------------
-----------------------------------
clearScreen ();
System.out.println(“\n\n”);
System.out.println(“Enter investment number of
investment to be modified: ”);
input = new StringBuffer ();
while ((c = (char) System.in.read ()) != ‘\n’) {
input.append (c);
}
found = false;
current = 0;
while(!found && (current < NUM_RECORDS)) {
if(portfolio[current].number.compareTo(input.toStrin
g())==0)
found = true;
else current = current +1;
}
if (!found)
System.out.println (“Record not found”);
else {
System.out.println (”\n\n”);
System.out.println (” 1. Investment Number
\n”);
System.out.println (” 2. Investment Name \n”);
System.out.println (” 3. Estimated Annual
Ret \n”);
System.out.println (”\n\n”);
System.out.println (”\n\n”);
case ’2’:
System.out.println (”Enter investment
name:”);
input = new StringBuffer ();
while ((c =(char) Sysem.in.read ()) != ’\n’) {
input.append (c);
}
portfolio[current].name = input.toString ();
break;
case ’3’:
System.out.println (”Enter estimated annual
return:”);
input = new StringBuffer ();
while ((c =(char) Sysem.in.read ()) != ’\n’) {
input.append (c);
}
Float tempFloat = new Float (input.toString
());
portfolio[current].ret = tempFloat.floatValue
();
portfolio[current].date = new Date ();
break;
} // switch
} // else
}
catch (Exception e) {
}
} // modifyInvestment
//----------------------------------------------------------------------------
-----------------------------------
clearScreen();
System.out.println (”\n\n”);
System.out.println (”Enter investment # of
investment to be deleted:”);
input = new StringBuffer ();
while((c = (char)System.in.read ()) != ’\n’) {
input.append (c);
}
found = false;
current = 1;
while (!found && (current < NUM_RECORDS)) {
if(portfolio[current].number.compareTo(input.toStrin
g())==0)
found = true;
else
current = current + 1;
}
if (!found)
System.out.println (”Record not found \n”);
else {
portfolio[current].number = new String
(”000000000000”);
System.out.println (”Record deleted”);
}
}
catch (Exception e) {
}
} // deleteInvestment
//----------------------------------------------------------------------------
-----------------------------------
//----------------------------------------------------------------------------
-----------------------------------
//----------------------------------------------------------------------------
-----------------------------------
//----------------------------------------------------------------------------
-----------------------------------
while (!done) {
clearScreen ();
System.out.println (”\n\n\n\n”);
System.out.println (” MORTGAGE
MENU”);
System.out.println (”\n\n”);
System.out.println (” 1.Add Mortgage
data”);
System.out.println ();
System.out.println (” 2.Modify Mortgage
data”);
System.out.println ();
System.out.println (” 3.Delete Mortgage
data”);
System.out.println ();
System.out.println (” 4.Return to Main
Menu”);
System.out.println (”\n\n”);
switch((char) choice[0]) {
case ‘1‘:
addMortgage ();
break;
case ‘2‘:
modifyMortgage ();
break;
case ‘3‘:
deleteMortgage ();
break;
case ‘4‘:
case ‘\n‘:
done = true;
break;
default:
System.out.println (”\n\n”);
System.out.println( ”Incorrect selection, try
again\n”);
break;
} // switch
}
}
catch (Exception e){
}
} // mortgageMenu
//----------------------------------------------------------------------------
-----------------------------------
//----------------------------------------------------------------------------
-----------------------------------
public void investmentMenu (){
//
// permite utilizatorului selectarea operaţiunilor asupra
informaţiilor de investiţie
//
try {
byte choice[] = new byte[10];
boolean done = false;
while (!done) {
clearScreen ();
System.out.println (”\n\n\n\n”);
System.out.println (” INVESTMENT
MENU\n”);
System.out.println (”\n\n”);
System.out.println (” 1.Add Investment
data\n”);
System.out.println (” 2.Modify Investment
data\n”);
System.out.println (” 3.Delete Investment
data\n”);
System.out.println (” 4.Return to Main
Menu\n”);
//----------------------------------------------------------------------------
-----------------------------------
clearScreen ();
System.out.println (”\n\n”);
System.out.println (” INVESTMENTS
REPORT”);
System.out.println (” MARTHA STOCKTON
GREENGAGE
FOUNDATION”);
System.out.println (” Investments Listing”);
System.out.println ();
System.out.println (”Item No.\tItem
Name\tEstimated\tDate Estimated ”);
System.out.println (”\t\t\t\t\tAnnual Ret\t Annual Ret
Updated”);
System.out.println
(”-----------------------------------------------------------
------------------\n”);
if(portfolio[counter].number.compareTo(”00000000
0000”)!=0) {
System.out.print (portfolio[counter].number +
”\t\t”);
System.out.print (portfolio[counter].name +
”\t\t”);
System.out.print (portfolio[counter].ret +
”\t\t”);
System.out.print
(portfolio[counter].date.getMonth()+1)+”/”);
System.out.print
(portfolio[counter].date.getDate () + ”/”);
System.out.println
(portfolio[counter].date.getYear ());
}
}
System.out.println (”\n\n”);
System.out.println (” Press ENTER to return to
main menu”);
System.in.read (c);
}
catch(Exception e) {
}
} // investmentListing
//----------------------------------------------------------------------------
-----------------------------------
public void report (){
//
// rulează fiecare program de rapoarte
//
try {
byte choice[] = new byte[10];
boolean done = false;
StringBuffer input;
while (!done) {
clearScreen ();
System.out.println (“\n\n”);
System.out.println (“ MARTHA STOCKTON
GREENGAGE FOUNDATION ”);
System.out.println (“ REPORTS”);
System.out.println ();
System.out.println (“ 1.Listing of all
Investments”);
System.out.println ();
System.out.println (“ 2.Listing of all
Mortgages”);
System.out.println ();
System.out.println (“ 3.Results of weekly
computations”);
System.out.println ();
System.out.println (“ 4.Return to MAIN
MENU”);
System.out.println (”\n\n”);
//----------------------------------------------------------------------------
-----------------------------------
while (!done) {
clearScreen ();
System.out.println (“\n\n\n\n”);
System.out.println (“ MARTHA
STOCKTON GREENGAGE
FOUNDATION ”);
System.out.println (”\n\n”);
System.out.println ();
System.out.println (“ 1.Maintain Investment
data\n”);
System.out.println (“ 2.Maintain Operating
Expenses data\n”);
}
1.15.Tema practică
Discuţie pe marginea exemplului de mai sus.
Alegeţi un proiect soft. Parcurgeţi etapele prezentate în
lucrare, pornind de la colectarea cerinţelor până la
dezvoltarea unui prototip.