A simple factorial a number in Java with Error Handling Message.
My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com
Learn Computer Programming Free from our source codes in my website.
Sponsored Link Please Support
https://www.techseries.dev/a/27966/qWm8FwLb
https://www.techseries.dev/a/19181/qWm8FwLb
My Personal Website is http://www.jakerpomperada.com
Email me at jakerpomperada@gmail.com and jakerpomperada@yahoo.com
A simple factorial a number in Java with Error Handling Message.
My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com
A simple factorial program with error handling in Java programming language.
My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com
Machine Problem
Create a simple quiz program using Java programming language.
My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com
Program Listing
/* Quiz.java
* Mr. Jake Rodriguez Pomperada,MAED-IT, MIT
* www.jakerpomperada.com www.jakerpomperada.blogspot.com
* jakerpomperada@gmail.com
* Bacolod City, Negros Occidental Philippiens
*/
import java.util.Scanner;
public class Quiz {
/**
* @param args
*/
static Scanner input = new Scanner(System.in);
public static void main(String[] args)
{
int score = 0;
final double NumberofQuestions = 5;
String[][] QandA = {
{"Who is the first president of the Philippines?","\n1. Emilio Aguinaldo \t 2. Joseph Estrada \n3. Manuel Quezon \t 4: GMA.","1","1. Emilio Aguinaldo"},
{"Hitler party which came into power in 1933 is known as?","\n1. Labour Party \t 2. Nazi Party \n3. Ku-Klux-Klan \t 4. Democratic Party","2", "2. Nazi Party"},
{"For which of the following disciplines is Nobel Prize awarded?","\n1. Physics and Chemistry \t 2. Physiology or Medicine \n3. Literature, Peace, and Economics \t 4. All of the above","4","4. All of the above."},
{"What is 3 * (2-1)?","\n1.1 \t 2.2 \t 3.3 \t 4.4 ","3","3.3"},
{"What is 1+1?","\n1.1 \t 2.2 \t 3.3 \t 4.4 ","2","2.2"} };
String[] Answers = new String[(int) NumberofQuestions];
int x=0;
do
{
System.out.println();
System.out.print(QandA[x][0] + " "+QandA[x][1] +"\n");
System.out.print("Enter [1-4]: ");
Answers[x] = String.valueOf(input.nextInt());
Answers[x].toLowerCase();
if(QandA[x][2].equals(Answers[x]))
{
System.out.print("Correct!");
score++;
}
else
{
System.out.print("Incorrect. The correct answer is: "+ QandA[x][3] );
}
System.out.print("\n");
x++;
}while(x<NumberofQuestions);
System.out.println();
System.out.print("Congratulations, you got " + score + " answers right!");
System.out.println("\nThat is a score of " + ((score/NumberofQuestions)*100)+"% percent.");
System.exit(0);
input.close();
}
} // End of Code
Machine Problem
Create a program
that converts numbers to words using Java programming language.
My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com
/* Number_Words.java
* Mr. Jake Rodriguez Pomperada,MAED-IT, MIT
* www.jakerpomperada.com www.jakerpomperada.blogspot.com
* jakerpomperada@gmail.com
* Bacolod City, Negros Occidental Philippines
*/
import java.util.Scanner;
public class Number_Words {
public static void main(String[] args) {
int number = 0;
Scanner input = new Scanner(System.in);
boolean valid;
do {
System.out.println();
System.out.print("\tNumber To Words in Java\n\n");
System.out.print("Enter Number: ");
number = input.nextInt();
valid = (number >= 1 && number <= 100000);
System.out.println();
if (number > 100000) {
System.out.print("Number is out of range!\n");
} else if (!valid) {
System.out.println("Negative numbers, zero, and numbers greater than 100,000 are invalid input.");
}
else {
System.out.print(numberToWord(number));
}
}while (!valid);
System.out.println("\n");
System.out.println("End of Program");
input.close();
}
private static String numberToWord(int number) {
String words = "";
String unitsArray[] = { "zero", "one", "two", "three", "four", "five", "six",
"seven", "eight", "nine", "ten", "eleven", "twelve",
"thirteen", "fourteen", "fifteen", "sixteen", "seventeen",
"eighteen", "nineteen" };
String tensArray[] = { "zero", "ten", "twenty", "thirty", "forty", "fifty",
"sixty", "seventy", "eighty", "ninety" };
if (number == 0) {
return "zero";
}
if (number < 0) {
String numberStr = "" + number;
numberStr = numberStr.substring(1);
return "minus " + numberToWord(Integer.parseInt(numberStr));
}
if ((number / 1000) > 0) {
words += numberToWord(number / 1000) + " thousand ";
number %= 1000;
}
if ((number / 100) > 0) {
words += numberToWord(number / 100) + " hundred ";
number %= 100;
}
if (number > 0) {
if (number < 20) {
words += unitsArray[number];
} else {
words += tensArray[number / 10];
if ((number % 10) > 0) {
words += "-" + unitsArray[number % 10];
}
}
}
return words;
}
}
A simple avatar image in HTML and CSS that I wrote I hope you will find my work useful.
My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com
Program Listing
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Simple Avatar Image in HTML & CSS</title>
<style>
*,
html {
box-sizing: border-box;
padding: 0;
margin: 0;
}
body {
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
background: #13141c;
}
main {
display: block;
padding: 30px;
border-radius: 10px;
background: #212330;
}
.container {
text-align: center;
color: #eee;
font-family: sans-serif;
height: auto;
}
.wrapper {
background: #8a8a8a;
padding: 2px;
border-radius: 50%;
width: 300px;
margin: 20px auto 0;
}
img {
display: block;
width: 100%;
border-radius: 50%;
}
</style>
</head>
<body>
<main>
<div class="container">
<h1>Simple Avatar Image in HTML & CSS</h1>
<h2>» Jake R. Pomperada, MAED-IT, MIT «</h2>
<div class="wrapper">
<img src="jacob.jpg" class="img-avatar" alt="" />
</div>
</div>
</main>
</body>
</html>
In this tutorial, I will share with you how to write a program that will ask the user to give two numbers, and then the program will compute the sum of the two given numbers using Julia programming language.
My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com
Program Listing
A simple program that I wrote in Microsoft Visual Basic NET to count, add, and find words in the text box I hope you will find my work useful.
My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com
Program Listing
' Created By Mr. Jake Rodriguez Pomperada, MAED-IT, MIT
' www.jakerpomperada.com and www.jakerpomperada.blogspot.com
' jakerpomperada@gmail.com
' Bacolod City, Negros Occidental Philippines
Public Class Form1
Function wordCount(ByVal str As String)
Dim NumberOfWord As Integer
NumberOfWord = UBound(Split(Trim(Replace(str, Space(2), Space(1))))) + 1
Return NumberOfWord
End Function
Private Sub RichTextBox1_TextChanged(sender As Object, e As EventArgs) Handles RichTextBox1.TextChanged
If RichTextBox1.Text.ToLower = "" Then
TextBox1.Text = "0"
Else
TextBox1.Text = wordCount(RichTextBox1.Text.ToLower)
End If
End Sub
Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
Dim str_input As String
str_input = (TextBox2.Text.ToLower)
RichTextBox1.AppendText(str_input + " ")
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim text1 As String
text1 = (RichTextBox1.Text)
Dim mysplit As Array
mysplit = Split(text1, TextBox3.Text)
Dim count As Integer
count = mysplit.Length - 1
Label4.Text = "No. of Matches : " & count
Label5.Text = "Find Word : " & TextBox3.Text.ToUpper
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
TextBox2.Text = ""
TextBox3.Text = ""
RichTextBox1.Text = ""
Label4.Text = ""
Label5.Text = ""
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
MsgBox("Created By Mr. Jake Rodriguez Pomperada, MAED-IT, MIT " & vbCrLf _
& "www.jakerpomperada.com and www.jakerpomperada.com" & vbCrLf _
& "jakerpomperada@gmail.com", MsgBoxStyle.Information, "About this Program")
End Sub
End Class
DOWNLOAD THE COMPLETE SOURCE CODE HERE
A simple program that I wrote to ask the user to give a number and then the program will check if the given number is an odd or even number.
My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com
Program Listing