Jump to content

Recommended Posts

  • 2 weeks later...
Posted

Hi,

I  need help with codes on pictures in attachments. I need it "now" cause I must pass the exam of programming who's I hate. Thanks for help!

 

http://i45.tinypic.com/35na1zm.jpg

http://i50.tinypic.com/14wgm13.jpg

 

we dont understand this language, translate exercises in english.

  • 2 weeks later...
Posted

They are wrote in polish language, i know its been a while but maybe u will learn something:

1. What variables will print on the screen below fragment of the program?

int e[][]={{45,5,6},{7,9,4},{8,8,9}};
for(int x[]:e) for(int y:[x]) System.out.print(y);

ok so in first line we have got 2 dimensional table, first[] before e, are all variables inside {}, so e[1] will give us {7,9,4}, but we always need to write something in 2nd [], which means number inside {}.

e[0][1] will give us 5, e[2][2] will give us 9.

for(int x[]:e) - thats something harder, we have got a loop which will create for us 3, 1 dimensioned tables, so first we will have int[] x = {45,5,6}; later x will be {7,9,4} and at the end {8,8,9}; so if we would have something like this:

for(int x[]:e) System.out.print(x[0]);

4578 - would appear.

now for(int y:[ x ]) - that doesnt exist in java 1.7, it should be for(int y:x) - loop will create y variable for each number in the table.

So first (y=45,x=0), (y=5,x=0), (y=6,x=0), (y=7,x=1) etc

what we have at the last is System.out.print(y).

So we will have 4556794889 :)

 

2.Create new object of class B, run method and set any value to variable i

class A {int i=10 ; int metoda(){int b=10; return b; }}
class B extends A {int i ; int metoda(int t){byte b=10; return b+t;}}

B ob = new B(); - creating new object of class B

ob.i = 123; - setting any value to variable i

 

3.What implements function?

 void function(){ int n=10; int[][] tab=new int[n][];
for(int i=0;i<n;i++) tab[i]=new int[i+1];
System.out.println(tab.length); System.out.println(tab[n-1].length); }

So, int[][] tab=new int[n][]; - we are creating new 2 dimensional table, tab length will be now n(10)

for(int i=0;i<n;i++) tab[i]=new int[i+1];

tab[0] length will be 1, tab[1] length will be 2 etc.

System.out.println(tab.length); - will give us tab length = 10

System.out.println(tab[n-1].length); - will give us length of tab[9], it will be 10

 

4.What will be printed on the screen?

 void function(){ int n=4; for(int i=n;i>1;i--){ for(int j=0;j<i;j++)
System.out.print(" "); System.out.println("*");} }

for(int i=n;i>1;i--)

- this loop will work 3 times, 4>1, 3>1 and 2>1, in each case, 2nd loop will start

for(int j=0;j<i;j++)

- when i=4, this will work 4 times(j=0, j=1, j=2 and j=3), each time j is increased, to the screen is added " ", and each time i is decreased, "*" and skipping to next line is printed so it will be like this:

    *
   *
  *

 

5. What will appear on the screen?

public class rozne {
enum wyliczenie {Syrenka(500), Fiat125p, OpelCorsa(25000), Yaris(26000), Laguna(45000);
private int cena;
wyliczenie(int cena){this.cena=cena;}
wyliczenie(){ this.cena=-1;}
int cena()Preturn cena;}
}
public static void main(String[] args) {
for(wyliczenie x: wyliczenie.values())
odpowiedz(x);
}
static void odpowiedz(wyliczenie ob)
{
switch(ob)
{
case Syrenka : System.out.print("\t Samochod ="+ob);
case Fiat125p : System.out.print("\t Samochod ="+ob);break;
case Laguna : System.out.print("\t Samochod ="+ob); break;
}}}

Ok so, this is runned first:

for(wyliczenie x: wyliczenie.values())

so each value of enum Wyliczenie will be in variable x, first x=Syrenka, 2nd x=Fiat125p etc

each time method odpowiedz is runned, we are going to switch - putting our x(now ob) inside and we are checking if ob=Syrenka later if ob=Fiat125p and at the end if ob=Laguna

so, at the beggining ob is Syranka, so we are printing \t - thats Tabulator, Samochod=Syrenka.

But hey, we dont have a break after that, so its not being closed, we are printing it 2nd time, now our text will be like this:

	 Samochod =Syrenka	 	 Samochod=Syrenka

later into odpowiedz, we are putting Fiat125p, it is printed only once since after System.out.print is break;

we are not printing OpelCorsa because we dont have anything like that in switch

at the end it will be like this:

 Samochod = Syrenka	 Samochod = Syrenka	 Samochod = Fiat125p	 Samochod = Laguna

 

6. What's wrong with the code?

class A{int a; public A(int i){a=4*i;}
void pokaz(){System.out.print(a);}}
class B extends A{int b; public B(int i, int j){super(i); b=2*j;}}
public class Main{ public static void main(String[] args){
B ob = new B(3,5); A oa; A o=new A(3); oa.pokaz();}}

Whats wrong with the code? hmm or isnt initialized, u cannot use oa.pokaz() on null or not yet initialized reference :)

 

7. What will appear in the screen?

class A{int a=1; int b=2; public A(int i,int j){}
public A(A o){a=2*o.a; b=3*o.b;} void pokaz(){System.out.println(a+"_"+b);} }
public class Main { public static void main(String[] args) {
A oa= new A(0,0);A ob= new A(oa);A oc= new A(ob);oc.pokaz(); }}

ok so first, this is runned: A oa= new A(0,0); - we are creating new object, i=0, j=0 but inside {} we have got nothing, so we are going to next line:

A ob= new A(oa); - now we have got a=2*o.a(1) so a=2, b=3*o.b(2), so b=6

A oc= new A(ob); - same thing, a=2*2=4, b*3*6=18

oc.pokaz(); - "4_18" will be printed on the screen :)

 

Hope that i helped somebody :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ⚔️ L2JOmen High Five - SERVIDOR 100% RETAIL ⚔️ 📢 SOLICITAMOS APOYO PARA TESTING 📢 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ¡Saludos, comunidad de Lineage II! Estamos desarrollando un proyecto ambicioso y de calidad: L2JOmen High Five, un servidor  100% RETAIL que busca ofrecer la experiencia más auténtica de High Five.  Nos encontramos en la fase de desarrollo y testing, y necesitamos tu ayuda para hacerlo  grande. Si eres un amante del retail, disfrutas probar nuevas funciones y quieres formar  parte de un proyecto serio desde sus inicios, ¡tu apoyo es invaluable! ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🎮 CARACTERÍSTICAS PRINCIPALES 🎮 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ✅ SERVIDOR 100% RETAIL    • Experiencia auténtica de High Five    • Geodata PTS Official    • Plataforma Premium 2025 ✅ SISTEMA DE RATES DINÁMICO (Progresión Retail x1 con ayuda x5 -> x1)    • XP: 1-20 (5.0x) | 21-40 (3.0x) | 41-60 (2.0x) | 61-75 (1.5x) | 76-85 (1.0x)    • SP: 1-20 (5.0x) | 21-40 (3.0x) | 41-60 (2.0x) | 61-75 (1.5x) | 76-85 (1.0x)    • Adena: x2.0 (Retail con pequeño ajuste)    • Drop y Spoil: x1.0 (Mobs, Raids y Epics) ✅ SISTEMA DE ENCANTAMIENTO PROFESIONAL    • Enchant Safe: +6 (100% seguro hasta +6)    • Enchant Máximo: +30    • Tasas de encantamiento balanceadas:      * 0-3: 100% | 4: 80% | 5: 75% | 6: 70% | 7: 65% | 8: 60%      * 9: 55% | 10: 50% | 11: 45% | 12: 40%      * 13: 10% | 14-25: 5-9% | 26-30: 1-4%    • Sistema Blessed Enchant habilitado ✅ INICIO DE PERSONAJE    • Dynasty Masterwork Set completo +12    • 1 Ticket para Weapon S +12    • Duración: 7 días ✅ CONFIGURACIÓN RETAIL    • Element Limit: Nivel 4    • Buffs: Duración de 1 hora    • Nobless: Obtenible mediante quest    • Subclass Máxima: 10 (Certificación para cada Subclass) ✅ SISTEMA DE FARM Y ECONOMÍA    • Múltiples monedas de farm (Adena, Ancient Adena, Coin of Luck, PC Bang Points, Farm Coins)    • Varias zonas de farm disponibles    • Zona de Party Farm (se habilita cada 3 horas por 1 hora)    • 4 Raids diarias programadas ✅ SISTEMA PC BANG POINTS    • Aproximadamente 10,000 puntos por 24 horas conectado    • Entrega cada 10 minutos    • Jugadores Normales: 60-72 puntos/intervalo    • Jugadores Premium: 96-116 puntos/intervalo    • 5% probabilidad de doble puntos ✅ SHOPS COMPLETOS    • Shop Normal (Adena y Farm Coins)    • Shop Donate (con opciones premium)    • Armaduras y Armas hasta Grado Dynasty, Moirai, S84    • Joyas completas, no incluye Epics    • Scrolls (Normales, Blessed, Divine, Ancient)    • Elementos hasta nivel 4-7    • Accesorios y consumibles ✅ SISTEMA VIP    • 5 niveles de VIP disponibles    • Bonificaciones progresivas de XP/SP/Drop    • Recompensas diarias exclusivas ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🤝 ¿QUÉ NECESITAMOS DE TI? 🤝 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🔍 TESTERS ACTIVOS    • Jugadores que prueben todas las funciones del servidor    • Feedback constructivo sobre bugs, balance y mejoras    • Reporte de problemas encontrados 🎮 JUGADORES DEDICADOS    • Amantes del retail que valoren la experiencia auténtica    • Personas dispuestas a ayudar a mejorar el proyecto    • Comunidad comprometida con el crecimiento del servidor 📊 REPORTES DETALLADOS    • Bugs y errores encontrados    • Sugerencias de balance    • Opiniones sobre el gameplay    • Feedback sobre sistemas implementados ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 💎 ¿POR QUÉ UNIRTE A L2JOmen? 💎 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🌟 PROYECTO SERIO Y COMPROMETIDO    • Desarrollo constante y mejoras continuas    • Atención a la comunidad activa    • Transparencia en todas las decisiones 🎯 EXPERIENCIA 100% RETAIL    • Sin modificaciones que rompan el juego original    • Balance auténtico de High Five    • Gameplay puro y tradicional ⚡ TECNOLOGÍA DE VANGUARDIA    • Servidor optimizado y estable    • Geodata oficial de PTS    • Sistema robusto y sin lag    • Sistema Anticheat Premium 🎁 RECOMPENSAS PARA TESTERS    • Participación activa en el desarrollo    • Reconocimiento especial en el lanzamiento    • Beneficios exclusivos para early testers ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 📞 CONTACTO E INFORMACIÓN 📞 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Si estás interesado en formar parte de este proyecto y ayudarnos a crear el mejor  servidor retail de High Five, contáctanos. Tu apoyo es fundamental para hacer realidad  este grandioso proyecto. 💬 Únete a nuestro grupo de testing 🌐 WhatsApp: https://chat.whatsapp.com/Km6uRtFsoUq2tNZZalo5HB?mode=wwt ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🏆 ¡Juntos construimos el mejor servidor retail! 🏆 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━  
    • any server used these files? if yes let me know in pm.
    • L2Net is an in-game (IG) bot. I already have Adrenaline for that. I'm looking for an out-of-game (OOG) bot - one that doesn’t require the Lineage 2 client to run.
    • I came here to say something about ave but it seems i am late already Note for people who might see this topic. Use custom sources of updater, do it your self, learn do it on your time and schedule. its only a how to build it in visual studio youtube video and you're done 90%   no time? pay to a pro like nevesoma.   its easy as fuck
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock