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?:))
- Xbox Series X|S
- Android szakmai topik
- Formula-1 humoros
- A fociról könnyedén, egy baráti társaságban
- Hogy is néznek ki a gépeink?
- Sütés, főzés és konyhai praktikák
- sziku69: Szólánc.
- Luck Dragon: Asszociációs játék. :)
- World of Tanks - MMO
- Kávé kezdőknek - amatőr koffeinisták anonim klubja
- További aktív témák...
- GYÖNYÖRŰ iPhone 12 Pro 128GB Pacific Blue -1 ÉV GARANCIA - Kártyafüggetlen, MS2919
- BESZÁMÍTÁS! Asus Prime H370 i5 8500 16GB DDR4 512GB SSD RTX 3050 6GB Thermaltake V3 FSP 400W
- GYÖNYÖRŰ iPhone 13 mini 128GB Midnight -1 ÉV GARANCIA - Kártyafüggetlen, MS3315, 90% Akkumulátor
- BESZÁMÍTÁS! LENOVO IdeaPad Gaming 3 Gamer notebook - R5 5500H 16GB DDR4 512GB SSD RTX 2050 4GB WIN11
- Telefon felvásárlás!! iPhone 16/iPhone 16 Plus/iPhone 16 Pro/iPhone 16 Pro Max
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest