Programming Activity 1-6
Programming Activity 1-6
Programming Activity 1-6
CODE:
System.out.println(Hello ("CLASSMATE"));
}
ACTIVITY 2
CODE:
import java.util.Scanner;
String name;
int age;
name = scanner.nextLine();
age = scanner.nextInt();
}
ACTIVITY 3
CODE:
import java.util.Scanner;
if (name.equals("+"))
else if (name.equals("-"))
else if (name.equals("x"))
else if (name.equals("%"))
method1();
}
ACTIVITY 4
CODE:
import java.util.Scanner;
do{
do{
shp = input.nextInt();
if(shp>2){
System.out.println("Out of Bound!");
}while(shp>2);
do{
row = input.nextInt();
if(row>30)
{
System.out.println("Error: Maximum Rows is 30.");
}while(row>30);
do{
column = input.nextInt();
if(column>30)
}while(column>30);
if(shp==1)
System.out.print("^");
System.out.println("");
else if(shp==2)
{
System.out.print("^");
System.out.println("");
else
System.out.println("Out of Bound!");
repeat = input.nextInt();
}while(repeat==1);
}
ACTIVITY 5
CODE:
import java.util.ArrayList;
import java.util.Scanner;
static int rep, opt, rem, obt, a, obj, total, ave, mini, maxi, niw;
do {
System.out.println("[2]Add Data?");
System.out.println("[9]Clear Data?");
opt = input.nextInt();
switch (opt) {
case 1:
System.out.println(numlist);
case 2: {
do {
add();
System.out.println(numlist);
case 3: {
do {
del();
case 4: {
do {
sel();
case 5: {
min();
case 6: {
max();
case 7: {
ave();
case 8: {
tot();
case 9: {
clr();
default :
System.out.println("Out of Bound!");
rep = input.nextInt();
System.out.println("Enter Value:");
a = input.nextInt();
numlist.add(a);
rep = input.nextInt();
System.out.println(numlist);
rep = input.nextInt();
numlist.remove(rem);
rep = input.nextInt();
numlist.remove(rem);
obj = input.nextInt();
System.out.println(obj);
niw = input.nextInt();
numlist.set(obt, niw);
rep = input.nextInt();
mini = numlist.get(i);
}System.out.println(mini);
}
public static void max() {
maxi = numlist.get(i);
}System.out.println(maxi);
total += numlist.get(i);
ave = total/numlist.size();
}System.out.println(ave);
total += numlist.get(i);
}System.out.println(total);
numlist.clear();
}
ACTIVITY 6
CODE:
import java.util.Scanner;
{"Sopia","Andrea", "Nathalie"} };
System.out.println("");
if (!firstname[name1][name2].equals(name3)) {
}
}