0% found this document useful (0 votes)
24 views3 pages

Nume Functie Linie: Package Import Public Class Public Public

The document contains code defining two classes - Personal and Muncitor that represent employees. The Personal class stores an employee's name and function. The Muncitor class extends Personal and adds an age attribute. Both classes have methods to display the employee details and read input from the keyboard to populate the attributes. The main method creates Muncitor objects, gets input and displays the output. It also defines an inner Produse class to store a list of construction products.

Uploaded by

dreaming_angel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views3 pages

Nume Functie Linie: Package Import Public Class Public Public

The document contains code defining two classes - Personal and Muncitor that represent employees. The Personal class stores an employee's name and function. The Muncitor class extends Personal and adds an age attribute. Both classes have methods to display the employee details and read input from the keyboard to populate the attributes. The main method creates Muncitor objects, gets input and displays the output. It also defines an inner Produse class to store a list of construction products.

Uploaded by

dreaming_angel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

package persoane;

import java.io.*;
public class Personal {
public String nume;
public String functie;
String linie;
public Personal(String numePers, String functiePers){
nume=numePers;
functie=functiePers;
}
void afiseaza(){
System.out.println("Numele: " + nume + ", Functia: " + functie);
}
void citesteDeLaTast() throws Exception {
BufferedReader fluxIntrare = new BufferedReader( new InputStreamReader
(System.in));
System.out.println("Dati un nume: ");
linie=fluxIntrare.readLine();
nume=linie;
System.out.println("Dati o functie: ");
linie=fluxIntrare.readLine();
functie=linie;
}
public static void main(String args[]) throws Exception{
Personal p1, p2;
p1 = new Personal("", "");
p1.citesteDeLaTast();
p2 = new Personal("", "");
p2.citesteDeLaTast();
p1.afiseaza();
p2.afiseaza();

}
}

package persoane;
import java.io.*;
public class Muncitor extends Personal{
int varsta;
public Muncitor(String numePers, String functiePers, int ani){
super(numePers, functiePers);
varsta=ani;
}
public void afiseaza(){
super.afiseaza();
System.out.println("Varsta: "+varsta);
}
public void citesteDeLaTast() throws Exception{
super.citesteDeLaTast();
BufferedReader fluxIntrare = new BufferedReader( new InputStreamReader
(System.in));
System.out.println("Dati o varsta: ");
linie=fluxIntrare.readLine();
varsta=Integer.parseInt(linie);
}

public static void main(String args[]) throws Exception{


Muncitor m1;
m1 = new Muncitor("", "", 7);
m1.citesteDeLaTast();
m1.afiseaza();
}

package produse;
import java.util.*;
import persoane.Muncitor;
public class Constructii {
class Produse extends HashSet {
public Produse() {
super();
}
public void adaugaa(String produs) {
add(produs);
}

public void afiseazaa() {


System.out.print("Produse:");
System.out.println(this);
}
public void main(String args[]){
Produse produse = new Produse();
produse.adaugaa("ciment");
produse.adaugaa("caramida");
produse.adaugaa("rumegus");
produse.afiseazaa();
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy