Ú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?:))
- HP ZBook Fury G8, i7-11850H, 32GB , RTX A2000 4GB, HP Garancia. Gyönyörű.
- Apple iPhone 12 Pro 128Gb, 12 hónap Garancia, Ezüst & kék Színben, Kártyafüggetlen
- Apple iPhone XS 64Gb, 12 hónap Garancia, Ezüst & Arany Színben, Kártyafüggetlen
- SANDBERG 133-95 WEBKAMERA - USB 2.0 - FULL HD /1080P -
- Kezdő Gamer PC-Számítógép! I5 6400 / GTX 1060 6GB / 16GB DDR4 / 128SSD+ 500GB SSHD
- Szerver / szerverterem / szerver infrastruktúra felvásárlás, 1-1db is, kiszállással, logisztikával
- GYÖNYÖRŰ iPhone 13 128GB Green -1 ÉV GARANCIA - Kártyafüggetlen, MS4495, 100% Akkumulátor
- BESZÁMÍTÁS! LENOVO ThinkPad P15 Gen2 munkaállomás - i7 11800H 16GB DDR4 1TB SSD RTX A2000 4GB W
- 3DKRAFT.HU - 3D NYOMTATÁS - AZONNALI ÁRAJÁNLAT - GYORS KIVITELEZÉS - 505+ POZITÍV ÉRTÉKELÉS
- Sosemhasznált! HP OmniBook 5 Flip i3-1315U 8GB 512GB 14" FHD+ áthajtós-érintős Gar.: 1 év
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest

