prezzoAlMq • float (): Returns the price per square meter of the property.
/ * kare meter Basina Dusen fiyati ogrenmemizi istiyor * /
• void print (): print data of the property.
/ * * istenilen verileri yazdiriyoruz /
2) sinif ArchivioImm;
ArchivioImm (int n)
/ * arsiv bir bir dizisi olusturmamizi istiyor beautiful degerde * /
boolean enter (the apartment)
/ * we check the data have been entered correctly
elimina boolean (String s, int nc)
/ * we want to delete the archive data * /
conveniente Immobile ()
/ * check whether there are appropriate customer calls phytate * /
void stamp ()
/ * print the archive icerigni * /
Un Archivio Immobiliare Immobiliare gestisce i Dati di un archivio di Insieme immobilization. Ogni
Immobile also indirizzo e caratterizzato, numero Civico, superficie, prezzo, e
numero di van. Segue ArchivioImm to come to class le Realizzare Immobile:
Classe Immobile:
• Real Estate (String indir, numCiv int, float, sup, prez float, int numVani):
creates an object property from the characteristics specified.
prezzoAlMq • float (): Returns the price per square meter property.
• void print (): print data of the property. • Any
accessor methods that provide access to the characteristics of the object-
policies.
ArchivioImm Class:
• ArchivioImm (int n): creates a file that can contain data to
pi `n properties.
u
• boolean post (Building i): inserts the property specified in the archive;
returns true if the property is properly inserted, false otherwise
`
minds (the archive and full).
• boolean delete (String, int n): remove, if present, the property
that address and number nc. Returns true if the property
was present in the archive, false otherwise.
• Building cost (): returns the property with the price per meter
`pi` down under on file (null if the file empty).
u
• float prezzoMedio (int v): returns the average price of properties in the file have
v vain.
• void print (): print the contents of the archive.
package pack;
import IngressoUscita.Console;
public class Property {private String
indir;
/ degiskenlerimizi atiyoruz * * / private int
numCiv;
private float m;
private float price
private int rooms;
public property (String i, int n, float m, float p, int v) {
/ * degiskenleri Gelen Veril esitliyoruz */
indir = i;
numCiv = n;
mq = m;
prezzo = p;
vani = v;
}
public float costoAlMq()
{
/* Fiyati metre karaye boluyoruz */
return prezzo / mq;
}
public String dammiIndir()
{
/* adresi donmesini istiyoruz */
return indir;
}
public int dammiNumCiv()
{
/* ev numarasini donmesini istiyoruz */
return numCiv;
}
public int dammiVani()
{return rooms;}
dammiPrezzo public float ()
{/ * * fiyati donduruyoruz /
return price;}
public void print () {
/ * verileri yazdiriyoruz * /
Console.scriviStringa (
indir + "" + + numCiv "," + m + "" + price +
"," + Rooms);
}}
pack package ;
import IngressoUscita.Console;
public class ArchivioImm
{/ * emlak verileri dizi icin Create the * /
private Immobile [] imm;
private int numImm;
public ArchivioImm (int n) {
/ * determine the size of array * /
imm = new Immobile [n];}
public boolean
inserisci (Immobile i)
{/ * array of real estate information and problem entering or turning to the value of true or false value * /
if (numImm \u0026lt;imm.length)
{imm [numImm] = i;
numImm + +;
return true;}
return false;}
public boolean elimina (String s, int nc)
{
/ * address and number from a given data, the deletion of making the * /
for (int i = 0; i \u0026lt;numImm; i + +)
if (
imm [i]. dammiIndir (). equals (s) & &
(imm [i]. dammiNumCiv () == nc))
{imm [i] = imm [- numImm];
imm [numImm] = null;
return true;}
return false;}
conveniente public Immobile () {Immobile
conv = null;
if (numImm == 0)
return conv;
conv = imm [0];
for (int i = 1; i \u0026lt;numImm; i + +)
if (imm [i]. costoAlMq () \u0026lt;conv.costoAlMq ())
conv = imm [i];
return conv;}
prezzoMedio public float (int v) {
/ * value according to the number given to us to find the lowest price in the price bluyoruz * / int conta = 0
;
float s = 0.0f;
for (int i = 0; i \u0026lt;numImm; i + +)
if (imm [i]. dammiVani () == v) {s + = imm
[i ]. dammiPrezzo ();
gasket + +;
} if (count! = 0)
s / = count;
return s;}
public void print () {
/ * arsivdeki emlak bilgilerini yazdiriyoruz * /
for (int i = 0; i \u0026lt;numImm i + +)
imm [i]. print ();}
}
package cap6.archivioimm;
IngressoUscita import .*;
public class Main
{public static void main (String [] args) {
/ * to ArchivioImm refarans atiyoruz olarak ve dizi olarak boyutunu 5 4 belirliyoruz ve dens Kayıt ve emlak veris atiyor edilip edilmedigini kontrol ediyoruz * / ai = new
ArchivioImm ArchivioImm (5);
Building i1 = new Property ("Via Mazzini, 16, 48.0f, 170000.0f, 3);
i2 Building = new Property ("way", 4, 88.0f, 350000.0f, 4);
Building i3 = new Property ("Via Aurelia, 111, 111.0f, 320000.0f, 5);
i4 = new Property Real Estate (via Bonanno ", 1, 53.0f, 180000.0f, 3);
if (ai.inserisci (i1)) Console.scriviStringa (" Added ");
Console.scriviStringa else (" Not connected ") ;
if (ai.inserisci (i2)) Console.scriviStringa ("Added");
Console.scriviStringa else ("Not connected");
if (ai.inserisci (i3)) Console.scriviStringa ("Added");
Console.scriviStringa else ("Not connected");
if ( ai.inserisci (i4)) Console.scriviStringa ("Added");
Console.scriviStringa else ("Not connected");
/ * * arsivdeki verileri yazdiriyoruz /
ai.stampa ();
Building tmp ai.conveniente = ();
Console.scriviStringa (The building more 'affordable' ");
tmp.stampa ();
ai.prezzoMedio float m = (3);
Console. scriviStringa ("Price per medio 3 Vani: ");
Console.scriviReale (m);
/ * find and delete data from a real estate given the address and number * /
if (ai.elimina (via" Mazzini ", 16)) Console. scriviStringa ("Eliminato");
Console.scriviStringa else ("non eliminato");
/ * print the current state of the archive * /
ai.stampa ();
}}
The following question
0 comments:
Post a Comment