Student: PANCHO, Ciandra V. Laboratory Activity IT21S2 CITE004

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

PANCHO, Ciandra V.

Laboratory Activity

IT21S2 CITE004

1. Student

package dataStructures;

import java.util.Scanner;

public class Student {


public static void main(String[] args) {

Scanner scan = new Scanner(System.in);

System.out.print("Name: ");
String name = scan.nextLine();

System.out.print("Gender: press 1 for Female press 2 for Male ");


byte option = scan.nextByte();

System.out.print("Student ID: ");


int id = scan.nextInt();

System.out.print("GWA: ");
float gwa = scan.nextFloat();

System.out.print("Student Balance: ");


double balance = scan.nextDouble();
scan.close();

System.out.println("\n\nDATA COLLECTED");
System.out.println("NAME: " +name);

switch(option) {
case 1:
System.out.println("GENDER: Female");
case 2:
System.out.println("GENDER: Male");
}

System.out.println("Student ID: "+id);


System.out.println("GWA: "+gwa);
System.out.println("BALANCE: "+balance);

}
Output:

2. Company
package dataStructures;

import java.util.Scanner;

public class Company {


public static void main(String[] args) {

Scanner scan = new Scanner(System.in);

System.out.print("Company Name: ");


String name = scan.nextLine();
System.out.print("Location: ");
String location = scan.nextLine();
System.out.print("Contact Info: ");
int num = scan.nextInt();
System.out.print("Number of Users: ");
long users = scan.nextLong();
System.out.print("Networth of the company: ");
double net = scan.nextDouble();
scan.close();

System.out.println("\n\nDATA COLLECTED");
System.out.println("Company Name: "+name);
System.out.println("Contact Info: "+num);
System.out.println("Location: "+location);
System.out.println("Number of users: "+users);
System.out.println("Networth: "+net);
}
}
Output:

3. Employee

package dataStructures;

import java.util.Scanner;

public class Employee {


public static void main(String[] args) {

Scanner scan = new Scanner(System.in);

System.out.println("FULL NAME: ");


String name = scan.nextLine();
System.out.println("SCHOOL: ");
String school = scan.nextLine();
System.out.println("Age: ");
byte age = scan.nextByte();
System.out.println("Gender: press 1 for Female press 2 for Male ");
byte option = scan.nextByte();
System.out.println("Contact Number: ");
int num = scan.nextInt();

scan.close();

System.out.println("\n\nDATA COLLECTED");
System.out.println("FULLNAME: "+name);
System.out.println("SCHOOL: "+school);
System.out.println("AGE: "+age);
switch(option) {
case 1:
System.out.println("GENDER: Female");
case 2:
System.out.println("GENDER: Male");
}
System.out.println("NUMBER: "+num);
}

Output:

4. Product

package dataStructures;

import java.util.Scanner;

public class Product {


public static void main(String[] args) {

Scanner scan = new Scanner(System.in);

System.out.println("Product Name: ");


String name = scan.nextLine();
System.out.println("Location: ");
String location = scan.nextLine();
System.out.println("Category: ");
String category = scan.nextLine();
System.out.println("Price: ");
double price = scan.nextDouble();
System.out.println("Expiration Date: ");
int date = scan.nextInt();

scan.close();

System.out.println("\n\nDATA COLLECTED");
System.out.println("Product Name: "+name);
System.out.println("Location: "+location);
System.out.println("Category: "+category);
System.out.println("Price: "+price);
System.out.println("Consume Before: "+date);
}

Output:

5. User

package dataStructures;

import java.util.Scanner;

public class User {


public static void main(String[] args) {

Scanner scan = new Scanner(System.in);

System.out.print("Username: ");
String name = scan.nextLine();

System.out.print("Password: ");
String pw = scan.nextLine();

System.out.print("Gender: press 1 for Female press 2 for Male ");


byte option = scan.nextByte();

System.out.print("User ID: ");


int id = scan.nextInt();
System.out.print("Mobile: ");
long num = scan.nextLong();

scan.close();

System.out.println("\n\nDATA COLLECTED");
System.out.println("USERNAME: " +name);

switch(option) {
case 1:
System.out.println("Gender: Female");
case 2:
System.out.println("Gender: Male");
}

System.out.println("User ID: "+id);


System.out.println("Mobile: "+num);
System.out.println("Password: *******");

}
}

Output:

You might also like