Panibagong thread about Java ulit mga lods
Some of my work free to copy if ever na gusto mong malaman how and what is the output of the program is it
Kung makikita nyo yung sa public class yung katabi nun it is depends on the name of your file and you will have to change it and it can be run the program.
Enter the Number of Students and Print out the Result in Percent
[CODE lang="java" title="Enter the Number of Students and Print out the Result in Percent"]import java.util.Scanner;
public class NumberOfStudents
{
public static void main(String[]args)
{
Scanner num = new Scanner(System.in);
System.out.println("Hello");
double male,female,numberOfStudents,total;
System.out.println("Enter the Number of Male : ");
male = num.nextInt();
System.out.println("Enter the Number of Female : ");
female = num.nextInt();
System.out.println("Number of Students : ");
numberOfStudents = num.nextInt();
double malePercent = (male / numberOfStudents) * 100;
System.out.println("Male : " + malePercent);
double femalePercent = (female / numberOfStudents) * 100;
System.out.println("Male : " + femalePercent);
}
}[/CODE]
Enter the Year and Find if Leap Year or Not
[CODE lang="java" title="Enter the Year and Find if Leap Year or Not"]import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int year;
Scanner scan = new Scanner(System.in);
System.out.println("Enter any Year:");
year = scan.nextInt();
scan.close();
boolean isLeap = false;
if(year % 4 == 0)
{
if( year % 100 == 0)
{
if ( year % 400 == 0)
isLeap = true;
else
isLeap = false;
}
else
isLeap = true;
}
else {
isLeap = false;
}
if(isLeap==true)
System.out.println(year + " is a Leap Year.");
else
System.out.println(year + " is not a Leap Year.");
}
}[/CODE]
Count the Vowel in Input String
[CODE lang="java" title="Count the Vowel in Input String"]import java.util.Scanner;
public class Main {
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.print("Input the string: ");
String str = in.nextLine();
System.out.print("Number of Vowels in the string: " + count_Vowels(str)+"\n");
}
public static int count_Vowels(String str)
{
int count = 0;
for (int i = 0; i < str.length(); i++)
{
if (str.charAt(i) == 'a' || str.charAt(i) == 'e' || str.charAt(i) == 'i'
|| str.charAt(i) == 'o' || str.charAt(i) == 'u')
{
count++;
}
}
return count;
}
}[/CODE]
Quiz Application
[CODE lang="java" title="Quiz Application"]import java.util.Scanner;
public class Array {
public static void main(String[] args)
{
Scanner num = new Scanner(System.in);
int NumCorrect = 0;
System.out.println("Welcome to Quiz and Answer in Java");
System.out.println("Question 1");
System.out.println("What is the Capital of the Philippines : ");
System.out.println("A. Manila");
System.out.println("B. Cebu");
System.out.println("C. Davao");
String response = num.nextLine();
if (response.equals("A"))
{
System.out.println("Correct!!");
NumCorrect += 1;
System.out.println("\n");
}
else
{
System.out.println("Nope! Wrong Answer!!");
System.out.println("\n");
}
System.out.println("Question 2");
System.out.println("Who's team won a M2 World Championshop : ");
System.out.println("A. BREN esports");
System.out.println("B. Burmese Ghouls");
System.out.println("C. RRQ");
response = num.nextLine();
if (response.equals("A"))
{
System.out.println("Correct!!");
NumCorrect += 1;
System.out.println("\n");
}
else
{
System.out.println("Nope! Wrong Answer!!");
System.out.println("\n");
}
System.out.println("Question 3");
System.out.println("Which Programming Language Doesn't use a semicolon [;] : ");
System.out.println("A. Java");
System.out.println("B. Python");
System.out.println("C. DevC");
response = num.nextLine();
if (response.equals("B"))
{
System.out.println("Correct!!");
NumCorrect += 1;
System.out.println("\n");
}
else
{
System.out.println("Nope! Wrong Answer!!");
System.out.println("\n");
}
System.out.println("Question 4");
System.out.println("Which is not a Programming Language : ");
System.out.println("A. Ruby");
System.out.println("B. Python");
System.out.println("C. HTML");
response = num.nextLine();
if (response.equals("C"))
{
System.out.println("Correct!!");
NumCorrect += 1;
System.out.println("\n");
}
else
{
System.out.println("Nope! Wrong Answer!!");
System.out.println("\n");
}
System.out.println("Question 5");
System.out.println("Country that does not belong to Southeast Asian : ");
System.out.println("A. Philippines");
System.out.println("B. Singapore");
System.out.println("C. Russia");
response = num.nextLine();
if (response.equals("C"))
{
System.out.println("Correct!!");
NumCorrect += 1;
System.out.println("\n");
}
else
{
System.out.println("Nope! Wrong Answer!!");
System.out.println("\n");
}
int TotalQuestion = 5;
double score = (100.0*NumCorrect) / TotalQuestion;
System.out.println("Your Total Score out of 5 Question is : " + score);
}
}[/CODE]
Basic Input and Output
[CODE lang="java" title="Basic Input and Output"]import java.util.Scanner;
public class Activity1 {
public static void main(String[] args)
{
Scanner name = new Scanner(System.in);
String firstname,lastname,mi;
String FaveCartChar;
int favenumber;
System.out.println("Activity 1");
System.out.println("\n");
System.out.println("Enter your First Name : ");
firstname = name.nextLine();
System.out.println("Enter your Last Name : ");
lastname = name.nextLine();
System.out.println("Enter your Middle Name : ");
mi = name.nextLine();
System.out.println("Enter your Favorite Number : ");
favenumber = name.nextInt();
System.out.println("Enter your Favorite Cartoon Character : ");
FaveCartChar = name.next();
System.out.println("\n");
System.out.println("My Name is " + firstname + " " + mi + " " + lastname);
System.out.println(favenumber + " is my Favorite Number");
System.out.println("I love " + FaveCartChar);
System.out.println("\n");
}
}[/CODE]
From now hangggang dito muna ulit comment lang kayo if gusto nyo pa ng panibago from another language to help some other and it will be good kung iintindihin nyo yung program at pagaaralan how does function it as well.
Sa mga newbie dyan don't worry mag popost ulit ako ng panibagong thread may mga gawa naman ako dito that we can help to pursue to learn programming.
Sa mga may assignment dyan click nyo to: https://phcorner.org/threads/kahit-load-lang-po-50-or-100.1024061/
Feeedback mga lodi
Some of my work free to copy if ever na gusto mong malaman how and what is the output of the program is it
Kung makikita nyo yung sa public class yung katabi nun it is depends on the name of your file and you will have to change it and it can be run the program.
Enter the Number of Students and Print out the Result in Percent
[CODE lang="java" title="Enter the Number of Students and Print out the Result in Percent"]import java.util.Scanner;
public class NumberOfStudents
{
public static void main(String[]args)
{
Scanner num = new Scanner(System.in);
System.out.println("Hello");
double male,female,numberOfStudents,total;
System.out.println("Enter the Number of Male : ");
male = num.nextInt();
System.out.println("Enter the Number of Female : ");
female = num.nextInt();
System.out.println("Number of Students : ");
numberOfStudents = num.nextInt();
double malePercent = (male / numberOfStudents) * 100;
System.out.println("Male : " + malePercent);
double femalePercent = (female / numberOfStudents) * 100;
System.out.println("Male : " + femalePercent);
}
}[/CODE]
Enter the Year and Find if Leap Year or Not
[CODE lang="java" title="Enter the Year and Find if Leap Year or Not"]import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int year;
Scanner scan = new Scanner(System.in);
System.out.println("Enter any Year:");
year = scan.nextInt();
scan.close();
boolean isLeap = false;
if(year % 4 == 0)
{
if( year % 100 == 0)
{
if ( year % 400 == 0)
isLeap = true;
else
isLeap = false;
}
else
isLeap = true;
}
else {
isLeap = false;
}
if(isLeap==true)
System.out.println(year + " is a Leap Year.");
else
System.out.println(year + " is not a Leap Year.");
}
}[/CODE]
Count the Vowel in Input String
[CODE lang="java" title="Count the Vowel in Input String"]import java.util.Scanner;
public class Main {
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.print("Input the string: ");
String str = in.nextLine();
System.out.print("Number of Vowels in the string: " + count_Vowels(str)+"\n");
}
public static int count_Vowels(String str)
{
int count = 0;
for (int i = 0; i < str.length(); i++)
{
if (str.charAt(i) == 'a' || str.charAt(i) == 'e' || str.charAt(i) == 'i'
|| str.charAt(i) == 'o' || str.charAt(i) == 'u')
{
count++;
}
}
return count;
}
}[/CODE]
Quiz Application
[CODE lang="java" title="Quiz Application"]import java.util.Scanner;
public class Array {
public static void main(String[] args)
{
Scanner num = new Scanner(System.in);
int NumCorrect = 0;
System.out.println("Welcome to Quiz and Answer in Java");
System.out.println("Question 1");
System.out.println("What is the Capital of the Philippines : ");
System.out.println("A. Manila");
System.out.println("B. Cebu");
System.out.println("C. Davao");
String response = num.nextLine();
if (response.equals("A"))
{
System.out.println("Correct!!");
NumCorrect += 1;
System.out.println("\n");
}
else
{
System.out.println("Nope! Wrong Answer!!");
System.out.println("\n");
}
System.out.println("Question 2");
System.out.println("Who's team won a M2 World Championshop : ");
System.out.println("A. BREN esports");
System.out.println("B. Burmese Ghouls");
System.out.println("C. RRQ");
response = num.nextLine();
if (response.equals("A"))
{
System.out.println("Correct!!");
NumCorrect += 1;
System.out.println("\n");
}
else
{
System.out.println("Nope! Wrong Answer!!");
System.out.println("\n");
}
System.out.println("Question 3");
System.out.println("Which Programming Language Doesn't use a semicolon [;] : ");
System.out.println("A. Java");
System.out.println("B. Python");
System.out.println("C. DevC");
response = num.nextLine();
if (response.equals("B"))
{
System.out.println("Correct!!");
NumCorrect += 1;
System.out.println("\n");
}
else
{
System.out.println("Nope! Wrong Answer!!");
System.out.println("\n");
}
System.out.println("Question 4");
System.out.println("Which is not a Programming Language : ");
System.out.println("A. Ruby");
System.out.println("B. Python");
System.out.println("C. HTML");
response = num.nextLine();
if (response.equals("C"))
{
System.out.println("Correct!!");
NumCorrect += 1;
System.out.println("\n");
}
else
{
System.out.println("Nope! Wrong Answer!!");
System.out.println("\n");
}
System.out.println("Question 5");
System.out.println("Country that does not belong to Southeast Asian : ");
System.out.println("A. Philippines");
System.out.println("B. Singapore");
System.out.println("C. Russia");
response = num.nextLine();
if (response.equals("C"))
{
System.out.println("Correct!!");
NumCorrect += 1;
System.out.println("\n");
}
else
{
System.out.println("Nope! Wrong Answer!!");
System.out.println("\n");
}
int TotalQuestion = 5;
double score = (100.0*NumCorrect) / TotalQuestion;
System.out.println("Your Total Score out of 5 Question is : " + score);
}
}[/CODE]
Basic Input and Output
[CODE lang="java" title="Basic Input and Output"]import java.util.Scanner;
public class Activity1 {
public static void main(String[] args)
{
Scanner name = new Scanner(System.in);
String firstname,lastname,mi;
String FaveCartChar;
int favenumber;
System.out.println("Activity 1");
System.out.println("\n");
System.out.println("Enter your First Name : ");
firstname = name.nextLine();
System.out.println("Enter your Last Name : ");
lastname = name.nextLine();
System.out.println("Enter your Middle Name : ");
mi = name.nextLine();
System.out.println("Enter your Favorite Number : ");
favenumber = name.nextInt();
System.out.println("Enter your Favorite Cartoon Character : ");
FaveCartChar = name.next();
System.out.println("\n");
System.out.println("My Name is " + firstname + " " + mi + " " + lastname);
System.out.println(favenumber + " is my Favorite Number");
System.out.println("I love " + FaveCartChar);
System.out.println("\n");
}
}[/CODE]
From now hangggang dito muna ulit comment lang kayo if gusto nyo pa ng panibago from another language to help some other and it will be good kung iintindihin nyo yung program at pagaaralan how does function it as well.
Sa mga newbie dyan don't worry mag popost ulit ako ng panibagong thread may mga gawa naman ako dito that we can help to pursue to learn programming.
Sa mga may assignment dyan click nyo to: https://phcorner.org/threads/kahit-load-lang-po-50-or-100.1024061/
Feeedback mga lodi
