Ú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?:))
- A fociról könnyedén, egy baráti társaságban
- Itt a Galaxy S26 széria: az Ultra fejlődött, a másik kettő alig
- Otthoni hálózat és internet megosztás
- Xbox Series X|S
- Kerékpárosok, bringások ide!
- Fejhallgató erősítő és DAC topik
- Egyéni arckép 2. lépés: ARCKÉPSZERKESZTŐ
- Samsung kuponkunyeráló
- Vezeték nélküli fülhallgatók
- Yettel topik
- További aktív témák...
- Új Dobozos HP 17-cp Nagyképernyős Multimédiás Laptop 17,3" -35% AMD Ryzen 7 7730U 8Mag 16/512 FHD
- Lenovo ThinkPad P15 G1 Tervező Vágó Laptop -50% 15,6" i7-10850H 32/512 QUADRO RTX 3000 6GB FHD
- Dell Precision 7760 Tervező Vágó Laptop -70% 17,3" i7-11850H 32/512GB NVIDIA A3000 6GB FHD
- Lenovo ThinkPad P16v G2 Mobil Munkaállomás -50% Ultra 7 165H 32/1TB RTX 2000 8GB 19Hó Gari
- Bontatlan! Új Lenovo Thinkpad T14 G5 Tartós Üzleti Laptop 14" -45% Ultra 7 165U 16/512 FHD+ Magyar!
- HIBÁTLAN iPhone 11 64GB Red -1 ÉV GARANCIA - Kártyafüggetlen, MS4388
- HIBÁTLAN iPhone 11 64GB White-1 ÉV GARANCIA - Kártyafüggetlen, MS4532,100% Akksi
- Samsung Galaxy S23 Ultra 256GB,Használt,Adatkabel,12 hónap garanciával
- Dell Precision 5690 - Intel Ultra 7, 16 magos, 32 GB RAM, 512GB SSD, NVIDIA RTX A1000, 16" , Új
- Apple iPhone SE 2022 64GB - Kártyafüggetlen, Éjfekete, 91% Akku - 1 Év Garanciával
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest


