- btz: Internet fejlesztés országosan!
- Luck Dragon: Asszociációs játék. :)
- Brogyi: CTEK akkumulátor töltő és másolatai
- f(x)=exp(x): A laposföld elmebaj: Vissza a jövőbe!
- sziku69: Fűzzük össze a szavakat :)
- D1Rect: Nagy "hülyétkapokazapróktól" topik
- vrob: Az IBM PC és a játékok a 80-as években
- Tomasz72: Ventilátor upgrade
- sziku69: Szólánc.
- MasterDeeJay: H110-es lapban 10.gen Comet Lake működhet?
Ú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?:))
- Easun iSolar SMW 11kW Twin Hibrid inverter // Dupla MPPT // BMS // WiFi
- GAMER PC : RYZEN 7 5700G/// 32 GB DDR4 /// RX 6700 XT 12 GB /// 512 GB NVME
- GAMER MSI LAPTOP : 15,6" 144 HZ /// i5 12450H /// 16GB DDR4/// RTX 4050 6GB/// 1TB NVME
- Manfrotto 055 magnézium fotó-videófej Q5 gyorskioldóval
- Sony ECM-W2BT
- Honor 200 , 8/256GB , Kártyafüggetlen
- Samsung Galaxy A41 64GB Kártyafüggetlen, 1Év Garanciával
- Xiaomi Redmi A3 64GB Kártyafüggetlen, 1Év Garanciával
- Telefon felvásárlás!! iPhone 12 Mini/iPhone 12/iPhone 12 Pro/iPhone 12 Pro Max
- AKCIÓ! Dell Precision 5820 XL Tower PC - Xeon W-2123 112GB RAM 512GB SSD 1TB RX 580 8GB Win 11
Állásajánlatok
Cég: CAMERA-PRO Hungary Kft
Város: Budapest
Cég: Promenade Publishing House Kft.
Város: Budapest