Hirdetés
Új hozzászólás Aktív témák
-
Azazello-
senior tag
lehetseges e egy boolian validation es ha igen, akkor hogyan?
/**
* This is my Concert class it contains informations about year, location and are there any ticket left.
*
* @author ()
* @version (10/12/09)
*/
public class Concert
{
private int year;
private String location;
private boolean ticketsLeft;
//Fields
public Concert(int conYear, String lct,boolean ticketAv){
year=conYear;
//this next line of code will call the method that will validate the information that is has been imput by the user
setLocation(lct);
ticketsLeft=ticketAv;
}
public Concert(){
year=0;
location="";
ticketsLeft=false;
}
//accessors
public int getYear(){
return year;
}
public String getLocation(){
return location;
}
public boolean getTicketsLeft(){
return ticketsLeft;
}
//mutators
public void setYear(int conYear){
year =conYear;
}
public void setLocation(String lct){
// the next line of code validates that the user has typed in "brighton Hastings or London"
if(lct.equals ("Brighton") || lct.equals("Hastings") || lct.equals("London")){
location = lct;
}
else{
//the next line of code print out a message when "Brighton Hastings or London" hasn't been typed
System.out.println("Valid locations: Brighton, Hastings, London");
}
}
public void setTicketsLeft(boolean ticketAv){
ticketsLeft = ticketAv;
}
//the next method will print out the Concert details
public void printConcert(){
System.out.println("Location: "+location);
System.out.println("Year :"+year);
System.out.println("Tickets Left: "+ticketsLeft);
}
}
Új hozzászólás Aktív témák
A topicot kiemeltem. Valaki nem akar egy nyitó hsz-t írni?:))
- Apple iPhone 15 Pro Max 256GB, Kártyafüggetlen, 1 Év Garanciával
- Apple iPhone 15 Pro Max 256GB, Kártyafüggetlen, 1 Év Garanciával
- Alig pár hónapos Rotel a8 erősítő eladó
- -ÚJ,2 ÉV GAR- GAMER PC: i5-14400F (10c/16t) +RTX 5050/5060/5060Ti/5070/5080 +16-64GB DDR4! SZÁMLA!
- -ÚJ,2 ÉV GAR- GAMER PC: RYZEN 7 5700/5800X +RX 6600/6700XT +16-64GB DDR4! SZÁMLA! 70 féle ház!
- ÚJ AKKU! Ár/ÉRTÉK BAJNOK! Dell Latitude 5330 i3-1215U 6mag! 16GB 512GB 13.3" FHD 1 év gar
- HIBÁTLAN iPhone 13 mini 128GB Starlight -1 ÉV GARANCIA -Kártyafüggetlen, MS3763, 100% Akksi
- HIBÁTLAN iPhone 12 mini 128GB Black -1 ÉV GARANCIA - Kártyafüggetlen, MS3303
- ÁRGARANCIA!Épített KomPhone Ryzen 7 7800X3D 32/64GB RAM RTX 5070Ti 16GB GAMER PC termékbeszámítással
- HIBÁTLAN iPhone 13 Pro 128GB Graphite -1 ÉV GARANCIA - Kártyafüggetlen, MS3747, 100% Akkumulátor
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest


