- Samsung Galaxy S25 Ultra - titán keret, acélos teljesítmény
- Honor Magic5 Pro - kamerák bűvöletében
- Profi EKG-s óra lett a Watch Fitből
- Samsung Galaxy S24 FE - később
- Samsung Galaxy S21 és S21+ - húszra akartak lapot húzni
- Samsung Galaxy A36 5G - a középső testvér
- Motorola Edge 50 Neo - az egyensúly gyengesége
- Magisk
- Milyen okostelefont vegyek?
- iPhone topik
Új hozzászólás Aktív témák
-
Azazello-
senior tag
koszonom szepen a segitseget mindenkinek.
nem erettsegi, csak alap programozas.
-
Azazello-
senior tag
senki sincs aki segitene?
-
Azazello-
senior tag
sziasztok,
vizsgahoz kellene par egyszeru kerdesre megdnom a valaszt, de sajna meg mindig nem megy magamtol. valaki segitene megoldani az alabbi problemakat?
1,
String[] myArray = {“Jan”,”Feb”,”Mar”,”Apr”};
Loop true and print them out:---------------------------
2,
• Test for String equality
String S1 = “One”;
String S2 = “One”;-----------------
3,
Storing primitives in an ArrayList
charValue
public char charValue()
- Returns the value of this Character object.
- Returns: the primitive char value represented by this object.----------------------
4,
- Loop over a String
erre nem tudom, hogy jo e a megoldas...:
ArrayList=al
Arrasy=arAl.size();
Ar.lenght;For(int i=0; i< ar.lenght; i++)
----------------
5,
Write a method to verify if the numbers of a series are in ascending order
Int[] num = {1,2,6,5};
Private boolean checkSort(int[] x){
for(int i=0; i < x.length; i++)
if(???)
}
-----------------------
6,
HashMap
- Add to a HashMap
- Delete from a HashMap
- Does it contain a practicular key?------------------------
ezekre kene a valasz, illetve megoldas. koszonom elore is.
-
Azazello-
senior tag
sziasztok, segitseget szeretnek kerni, hazi feladat megoldasa kozben elakadtam.
egy lottoszam sorsolo programot kell keszitenem.
ket class van, Ticket es Numbers. a numbers class kisorsol 6 szamot es sorrendbe allitja oket. a ticket classnal pedig meg kene oldanom, hogy adott mennyisegu tickettet lehessen kerni, es azokat ki is leessen nyomtatni.a nyomtatas reszenel akadtam el.
Numbers class:
public class Numbers
{
//fields
private Random randomNumber;
private int[] index;
private final int MAX = 6;
private final int MAXSIZE = 49;
// Constructor : Initialise number array
public Numbers(){
index = new int[MAX];
randomNumber = new Random();
generateNumber(MAXSIZE);
sortNum();
}
// Method : Generate 6 random numbers in a range 1 to 49
public void generateNumber(int n){
for(int i=0;i<MAX;i++){
index[i] = randomNumber.nextInt(n) + 1;
for(int k=0;k<i;k++){
if(index[k] == index[i]){
i--;
break;
}
}
}
}
// Method : Sort 6 numbers in ascending order
public void sortNum(){
int t;
//outer loop - j number of passes
for(int j=0;j<index.length;j++){
//inner loop - one pass
for(int i=0;i<index.length-1;i++){
if (index[i] > index[i+1]){
t = index[i];
index[i] = index[i+1];
index[i+1] = t;
}
}
}
}
// Method : Format and display 6 numbers to the screen
public void printLine(){
for(int i=0;i<index.length;i++){
System.out.printf("%2d ",index[i]);
}
System.out.println();
}
}Ticket class:
public class Ticket
{
private int numberOfLines;
private ArrayList<Numbers> lottoLines;
// Constructor : Creates an arrayList of Lucky Dip numbers, takes one argument to load the numberOfLines field.
public Ticket(int numOfLines){
lottoLines = new ArrayList<Numbers>();
for(int i=0;i<numOfLines;i++){
lottoLines.add(new Numbers());
}
}
// Method : Display the ticket details and the list of Lucky Dip numbers to the screen.
public void printTicket(){
System.out.println("* * * * * * * * * * * * * *");
System.out.println("** **");
System.out.println("** Lottery Tickets **");
System.out.println("** **");
System.out.println("* * * * * * * * * * * * * *");
//access each element of the arrayList and call its printLine() method
}
}a kerdes annyi volna, hogy hogyan tudom kinyomtattatni a kert ticketteket?
koszonom
-
Azazello-
senior tag
megprobalom maskepp feltenni a kerdest
boolian if statementet hogyan kell?
ticket available true/false-ot kene beallitanom, hogy ha nincs tobb ticket, akkor nyomtassa ki, hogy "sold out"...
-
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);
}
} -
Azazello-
senior tag
idaig sikerult eljutnom _asszem_ jol:
concert:
/**
* Write a description of class Concert here.
*
*
*/
public class Concert
{
private int year;
private String location;
private boolean ticketsLeft;
//Fieldspublic Concert(int y, String l,boolean t){
year=y;
location=l;
ticketsLeft=t;
}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 y){
year =y;
}
public void setLocation(String s){
location = s;
}
public void setTicketsLeft(boolean b){
ticketsLeft = b;
}public void printConcert(){
System.out.println("Location: "+location);
System.out.println("Year :"+year);
System.out.println("Tickets Left: "+ticketsLeft);
}}
CD:
/**
* A class that maintains information on a CD.
*
*
*/public class CD
{
// The fields.
private Artist performer;private String album;
private String genre;
private int numberOfTracks;
private int yearReleased;/*
*Create two constructors - one to take arguments for all fields - one that takes none.
*/
public CD (String a, String g, int tr, int y){album=a;
genre=g;
numberOfTracks=tr;
yearReleased=y;
}public CD(){
album="";
genre="";
numberOfTracks=0;
yearReleased=0;}
//accessor methods
public String getAlbum(){
return album;
}public String getGenre(){
return genre;
}public int getTracks(){
return numberOfTracks;
}public int getYear(){
return yearReleased;
}// mutator methods
public void getAlbum(String a){
album = a;
}public void getgenre(String g){
genre = g;
}public void getTracks(int tr){
numberOfTracks=tr;
}public void getYear(int y){
yearReleased=y;
}//print the details of the CD to the console
public void printCD(){
System.out.println("Album Title "+album);
System.out.println("Album Genre "+genre);
System.out.println("Number of Tracks "+numberOfTracks);
System.out.println("Year Relased "+yearReleased);
}
}Artist:
/**
* Write a description of class Artist here.
**/
public class Artist
{
// instance variables
private String firstname;
private String lastname;
private int age;
private Concert nextConcert;/**
* Constructor(s) for objects of class Artist
*/public Artist (String fName, String lName, int artistAge, Concert nextConcert){
firstname=fName;
lastname=lName;
age=artistAge;
nextConcert = new Concert();
}public Artist(){
firstname="";
lastname="";
age=0;
nextConcert = new Concert();
}/**
* accessor methods
*/
public String getName(){
return firstname;
}public String getlName(){
return lastname;
}public int getAge(){
return age;
}/**
* mutator methods
*/
public void printArtist(){
nextConcert.printConcert();}
}
-
Azazello-
senior tag
egyelore ez a Concert:
/**
* Write a description of class Concert here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Concert
{
private int year;
private String location;
private boolean ticketsLeft;
//Fieldspublic Concert(int y, String l,boolean t){
year=y;
location=l;
ticketsLeft=t;
}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 y){
year =y;
}
public void setLocation(String s){
location = s;
}
public void setTicketsLeft(boolean b){
ticketsLeft = b;
}public void printConcert(){
System.out.println("Locatio: "+location);
System.out.println("Year :"+year);
System.out.println("Tickets Left: "+ticketsLeft);
}}
es ez az Artist:
/**
* Write a description of class Artist here.
*
* @author (Oliver Szotyori)
* @version (01/12/09)
*/
public class Artist
{
// instance variables
private String firstname;
private String lastname;
private int age;
private Concert nextConcert;/**
* Constructor(s) for objects of class Artist
*/public Artist (String fName, String lName, int artistAge, Concert nConcert){
firstname=fName;
lastname=lName;
age=artistAge;
nextConcert = new Concert();}
public Artist(){
firstname=null;
lastname=null;
age=0;
nextConcert = new Concert();
}/**
* accessor methods
*//**
* mutator methods
*/
public void printArtist(){
nextConcert.printConcert();}
}
hogyan adom hozza, hogy az artist kinyomtassa a concert reszleteit is??
-
Azazello-
senior tag
kezdjuk elorol: mi kerul a CD-be?
oda kene 2 constructor eloszor.
// The fields.
private Artist performer;private String album;
private String genre;
private int numberOfTracks;
private int yearReleased;/*
*Create two constructors - one to take arguments for all fields - one that takes none.
*/
public Artist(int sAlbum,int Sgenre){valahogy igy kene kezdeni???
-
Azazello-
senior tag
cd:
class CD
{
// The fields.
private Artist performer;private String album;
private String genre;
private int numberOfTracks;
private int yearReleased;/*
*Create two constructors - one to take arguments for all fields - one that takes none.
*/
public Artist(int sAlbum,int Sgenre){Artist
public class Artist
{
// instance variables
private String firstname;
private String lastname;
private int age;
private Concert nextConcert;ennyi va megadva, es ebbol kene kihoznom vlamit.
ha legalabb a CD-nel tudnal segiteni,hogy hogyan epitsem fel, akkor abbol talan meg tudom oldani a masik kettot is.
-
Azazello-
senior tag
sziasztok!
nem vagyok benne biztos, hogy jo helyen jarok, bluej projecthez kellene egy kis segitseg, de nem igazan tudom, hogy kihez forduljak, melyik volna a megfelelo topic.
teljesen basic feladat:
Tasks
You have been provided with a BlueJ project file and accompanying class templates for a simple system to hold and manipulate information regarding a Compact Disc.The following Class diagram describes the relationship between the supplied class templates.
Assignment Tasks
1. Think about the data requirements for a Concert class. Add the relevant fields to the Concert class.
2. Create two constructors for each class - one to take arguments for all fields - one that takes none.
3. Add accessor and mutator methods as required to all three classes.4. Add a print method to each class.
• These methods should print to the terminal window.
• For the CD class, add a print method that will print details of the CD, Artist and the artist’s next concert.
• For any field not yet set, output an appropriate message (e.g. ‘Details not yet received’).5. Apply the following validation rules to class fields:
• CD
• private String genre – restricted to ‘Soul’, ‘Jazz’, or ‘Blues’
• private int numberOfTracks – must be greater than zero.
• private int yearReleased – must be a value greater than 1900 but less than 2004• Artist
• private int age – must be greater than zero and less than 120• Concert
• Devise and implement validation rules based on your choice of fields for this class-----------------------
ebben kene nekem segitseg, mert sajna azt sem tudom, hogy hol kezdjem el
(
elore is koszi.
Új hozzászólás Aktív témák
Hirdetés
A topicot kiemeltem. Valaki nem akar egy nyitó hsz-t írni?:))
- OTP Bank topic
- Milyen házat vegyek?
- PROHARDVER! feedback: bugok, problémák, ötletek
- DJI topic
- Az áremelések és a GTA VI késése miatt nem költekeznek a játékosok?
- Eredeti játékok OFF topik
- OLED monitor topik
- PlayStation 3
- Nvidia GPU-k jövője - amit tudni vélünk
- Bejelentette az Arc A sorozat nyugdíjazását az Intel
- További aktív témák...
- Samsung Galaxy S24 Ultra 5G 256GB, Kártyafüggetlen, 1 Év Garanciával
- Eladó Konfig Ryzen 7 7700 32GB DDR5 1TB SSD RTX5070 12GB!
- Precision 5550 15.6" 4K+ IPS érintő i7-10750H Quadro T1000 16GB 512GB NVMe ujjlolv IR kam gar
- Amazon Kindle (10. gen) eBook olvasó
- Latitude 5550 15.6" FHD IPS Ultra 5 135U 16GB 512GB NVMe magyar vbill ujjolv IR kam gar
- 118 - Lenovo Legion Pro 5 (16ARX8) - AMD Ryzen 9 7945HX, RTX 4070 - UK billentyűzet
- Csere-Beszámítás! Számítógép PC Játékra! Intel I7 6700/ RX 580 8GB / 32GB DDR4 / 500GB SSD
- BESZÁMÍTÁS! ASUS H81M-PLUS H81 chipset alaplap garanciával hibátlan működéssel
- ÁRGARANCIA!Épített KomPhone i9 14900KF 32/64GB RAM RX 9070 XT 16GB GAMER PC termékbeszámítással
- Külföldi csomagszállítás Packeta csomagpontokon keresztül!
Állásajánlatok
Cég: Promenade Publishing House Kft.
Város: Budapest
Cég: PC Trade Systems Kft.
Város: Szeged