0% found this document useful (0 votes)
19 views

Cit 207 - Project

The document contains 7 Java programs. Each program defines a class with a main method that performs various tasks like: 1) Printing personal details and arithmetic operations on variables 2) Taking user input for trash type and outputting the type 3) Creating patterns of asterisks based on user-defined rows and columns

Uploaded by

toklorega
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)
19 views

Cit 207 - Project

The document contains 7 Java programs. Each program defines a class with a main method that performs various tasks like: 1) Printing personal details and arithmetic operations on variables 2) Taking user input for trash type and outputting the type 3) Creating patterns of asterisks based on user-defined rows and columns

Uploaded by

toklorega
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/ 5

package Lorega;

import java.util.Scanner;
public class Describeyourself {
public static void main(String[]args) {
Scanner scanner = new Scanner (System.in);

String name = "Bryan M. Lorega";


String address ="cabalabaguan Mina, Iloilo";
String hobby = "Watching tv";
String age ="19";

System.out.println("Bryan M. Lorega" + name);


System.out.println("cabalabaguan Mina, Iloilo" );
System.out.println("Watching tv" + hobby);
System.out.println("19" );

package Lorega;
import java.util.Scanner;
public class Activity2 {

public static void main(String[] args) {

//declare the variable//


int a=20, b=15, c=50;

//addition operation//
System.out.println("a + b + c= " + (a + b + c));

//multiplication operation//
System.out.println("a * b * c= " + (a * b * c));

//subtraction operation//
System.out.println("a - b - c= " + (a - b - c));

//division operation//
System.out.println("a / b / c= " + (a / b / c));
}

}
package Lorega;
import java.util.Scanner;
public class Activity3{

public static void main(String[] args) {


Scanner s = new Scanner (System.in);

System.out.println("Enter your grade:");


int grade = s.nextInt();

if (grade >= 96) {


System.out.println("Excellent");
}

else if (grade >= 90 ){


System.out.println("Very Good");
}

else if (grade >= 85) {


System.out.println("Good");
}

else if (grade >= 80 ) {


System.out.println("Fair");
}

else if (grade >= 76 ) {


System.out.println("Poor");
}

else {
System.out.println("Failed");
}
}
}

package Lorega;
import java.util.Scanner;
public class Activity4 {

public static void main(String[] args) {

Scanner scanner = new Scanner(System.in);


System.out.println("Welcome to Trash Segregation!");
System.out.println("Enter the type of trash Red, Yellow, Green, Black or
exit");

while (true) {
String trashType = scanner.nextLine();
if (trashType.equals("exit")) {
break;}
switch (trashType) {
case "Red":
System.out.println("The garbage is NON-BIODEGRADABLE.");
break;
case "Yellow":
System.out.println("The garbage is BIODEGRADABLE.");
break;
case "Green":
System.out.println("The garbage is RECYCLABLE.");
break;
case "Black": System.out.println("The garbage is RESIDUAL.");
break;
default: System.out.println("Invalid input. Please enter 'Red', 'Yellow',
'Green', 'Black' or 'exit'.");
break;
}
}
System.out.println("Thank you for the Trash Segregation!"); scanner.close();
}
}

package Lorega;
import java.util.Scanner;
public class Activity5 {
public static void main(String[] args)
{
int rows, colummns, x , y;
Scanner s = new Scanner(System.in);
System.out.print("Please Enter Number of Rows:");
rows = s.nextInt();
System.out.print("Please Enter Number of Colummns: ");
colummns = s.nextInt();
for (x = 1 ; x <= rows; x++)
{
for (y = 1 ; y <= colummns; y++)
{
System.out.print("*");
}
System.out.print("\n");

}
}
package Lorega;
import java.util.Scanner;
public class Activity6 {
public static void main(String[] args)
{
int rows, colummns, x , y;
Scanner s = new Scanner(System.in);
System.out.print("Please Enter Number of Rows:");
rows = s.nextInt();
System.out.print("Please Enter Number of Colummns: ");
colummns = s.nextInt();
for (x = 1 ; x <= rows; x++)
{
for (y = 1 ; y <= colummns; y++)
{
System.out.print("*");
}
System.out.print("\n");

}
}
}

package Lorega;
import java.util.Scanner;
public class Activity7 {

public static void main(String[] args)


{
int rows, columns, i =1, j=1;
Scanner s = new Scanner(System.in);

System.out.print(" Please Enter Number of Rows : ");


rows = s.nextInt();
rows = s.nextInt();

System.out.print(" Please Enter Number of Columns : ");


columns = s.nextInt();

do {
System.out.print(" * ");
i++;
} while (i <= rows);

do {
System.out.print(" \n ");
j++;
} while (j <= columns);
}
}

You might also like