Monday, June 21, 2021

Overall Average Grade Solver in C++

 A simple overall average grade solver that I wrote using C++ programming language. I am using codeblocks to run my program.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website, kindly contact me also at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360








Program Listing

#include <iostream>

#include <iomanip>

#include <cmath>

#include <string>


#define EXIT_IF(cnd, msg) if(cnd){std::cerr << msg; exit(1);}


std::string get_performance(double grade)

{

if (grade < 70)

return "Poor";

else if(grade <= 74)

return "For Improvement";

else if (grade <= 80)

return "Good";

else if (grade <= 90)

return "Very good";

else

return "Excellent";

}


int main()

{

constexpr int num_grades = 5;

int num_students = 0, student, grade;

double sum , total_sum = 0.0;


std::cout << "Number of students in the class? ";

std::cin >> num_students;

std::cin.ignore(255, '\n');

EXIT_IF(num_students < 0, "Invalid Input: Please enter a nonnegative integer.");

for (student = 0; student < num_students; ++student)

{

sum = 0.0;

for (grade = 0; grade < num_grades; ++grade)

{

std::cout << "Grade of Student #" << student + 1 << " in Subject " << grade + 1 << ": ";

int tmp;

std::cin >> tmp;

EXIT_IF(tmp < 0, "Invalid Input: Please enter a nonnegative integer.");

sum += tmp;

}

double avg = std::round(sum / num_grades);

std::cout << "Average of Student " << student + 1 << " is : " << avg << "\n";

total_sum += avg;

}

double class_average = total_sum / num_students;

std::cout << std::fixed << std::setprecision(2) <<

"Class Average Grade is : " << class_average << "\n";

std::cout << "Class Performance is " << get_performance(class_average) << "\n";

}


Saturday, June 19, 2021

Reverse a String Using a Function in Python

 Machine Problem in Python


1. Write a Python program to reverse a string

2. The user will input a word

3. Create a function that will reverse the string.

4. Display the original word, the reversed word in all caps and string count.

Sample Program Output

INPUT: Hello World

OUTPUT: DLROW OLLEH (11 characters)


I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website, kindly contact me also at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360






Program Listing

reverse_string.py

def reverse_string(word):
return word[::-1]

string = input("Enter a string: ")
print(string)
print(reverse_string(string.upper()))
print("String count: ", len(string))



Student Average Using Functions in Python

 Machine Problem in Python

1. Write a program that computes students average

2. Use a function with 4 parameters (Name, Math, English and Science Grade)

3. Reference the function 3 times with different values

Sample Program Output

John’s grade (Math=?, Science=?, English=?) and the average is ?

Ana’s grade (Math=?, Science=?, English=?) and the average is ?

Frank’s grade (Math=?, Science=?, English=?) and the average is ?


I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website, kindly contact me also at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360





Program Listing

average_function.py


def Average(Name,Math,English,Science):
solve = int(Math+English+Science)/3
print("{0}'s grade (Math={1}, Science={2},English={3}),and the average is {4}."
.format(Name,Math,English,Science,round(solve)))

print()
Average("John",85,91,77)
print()
Average("Ana",83,89,93)
print()
Average("Frank",93,76,89)


Word Bank in Python

Word Bank in Python

 Machine Problem in Python

1. Write a word bank program

2. The program will ask to enter a word

3. The program will store the word in a list

4. The program will ask if the user wants to try again. The user will input

Y/y if Yes and N/n if No

5. If Yes, refer to step 2.

6. If No, Display the total number of words and all the words that user

entered.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website, kindly contact me also at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360





Program Listing

res = "y"
wordbank = list()
while res.lower() == "y":
word = str(input("Enter a word: "))
wordbank.append(word)
res = str(input("Do you want to try again? (Y/N)"))
print("=======")
print(f"Total Number of Words: {len(wordbank)}")
print("Word in the list:")
for w in wordbank:
print(w)


Loan Calculator in PHP

 I wrote this simple loan calculator to solve the loan of the customer using PHP programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website, kindly contact me also at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360






Program Listing

index.php


<!doctype html>

<html>

<head>

<title>Loan Calculator in PHP</title>

</head>

<body>

<form method="POST" action="">

<h2>Loan Calculator in PHP</h2>

<?php

$amount=$interest_rate=$period=NULL;

$total_interest=$total_payable=$monthly_payable=0;

if(isset($_POST['compute'])){

$amount=$_POST['amount'];

$interest_rate=$_POST['interest_rate'];

$period=$_POST['period'];

$total_interest=$amount*($interest_rate/100)*$period;

$total_payable=$total_interest+$amount;

$monthly_payable=$total_payable/$period;

}

?>

<p>Amount Needed: <input type="text" name="amount" size="8" value="<?=$amount;?>"/></p>

<p>Interest Rate: <input type="text" name="interest_rate" size="8" value="<?=$interest_rate;?>"/></p>

<p>Payment Period: <input type="text" name="period" size="8" value="<?=$period;?>"/></p>

<p><input type="submit" name="compute" value="Compute"/></p>

<p>

Loan Amount: <?=number_format($amount, 2);?><br/>

Total Interest: <?=number_format($total_interest, 2);?><br/>

Total Payable: <?=number_format($total_payable, 2);?><br/>

Monthly Payable: <?=number_format($monthly_payable, 2);?>

</p>

</form>

</body>

</html> 


Thursday, June 17, 2021

Display Message 20 Times Using Python

Display Message 20 Times in Python

Display Message 20 Times in Python

Machine Problem Using While Loop in Python

1. Write a program that will loop the message 20 times. Use while loop

only.

Python while loop number 1

Python while loop number 2

...

Python while loop number 20

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website, kindly contact me also at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360






Program Listing

i = 1

while i <= 20:
print("Python while loop number", i)
i += 1

Addition of Two Number With Do You Want To Try Again in Python

Addition of Two Numbers With Do You Want To Try Again Using Python

 A simple program to ask the user to give two numbers and then the program will compute the sum of two numbers and ask the use if the user want to try again using python programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website, kindly contact me also at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.





Program Listing

num1 = int(input("Enter first number: "))
num2 = int(input("Enter second number: "))
sum = num1 + num2
print("The sum of {0} and {1} is {2}.".format(num1, num2, sum))
ans = input("Do you want to try again?: ")

while ans.upper() == "Y":
num1 = int(input("Enter first number: "))
num2 = int(input("Enter second number: "))
sum = num1 + num2
print("The sum of {0} and {1} is {2}." .format(num1,num2, sum))
ans = input("Do you want to try again?: ")

print("Thank you!")

My First Book Ever Published

Product of Two Numbers in JavaScript

Product of Two Numbers in JavaScript

 A simple program to ask the user to give two numbers and then it will multiply the two given numbers using JavaScript programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website, kindly contact me also at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.





Program Listing

index.htm

<!doctype html>

<html>

<head>

<style>

      body {

      font-family: arial;

      font-size: 14px;

      background: lightgreen;

      }

</style>

<script>

function clear_all() {

document.getElementById("first").value ="";

document.getElementById("second").value ="";

document.getElementById("answer").value= "";

document.getElementById("first").focus();

}


function product(){

var a,b,c;

a=Number(document.getElementById("first").value);

b=Number(document.getElementById("second").value);

c= a * b;

document.getElementById("answer").value= c;

}

</script>

</head>

<body>

<h2>Product of Two Numbers in JavaScript </h2>

Enter the First number : <input id="first"><br><br>

Enter the Second number: <input id="second"><br><br>

The product <input id="answer"><br><br>

<button onclick="product()" title="Click here to solve the product.">

Solve</button>

<button onclick="clear_all()" title="Click here to clear the text box.">

Clear</button>

</body>

</html>


Monday, June 14, 2021

Kilograms To Pounds Using Swing in Java

Kilogram To Pounds Using Swing in Java

 A program that will ask the kilograms and then it will convert into pounds equivalent using swing in Java programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website, kindly contact me also at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.







Program Listing

Kilograms_Pounds.java


package com.jakerpomperada.kilograms_pounds;


/*

 * To change this license header, choose License Headers in Project Properties.

 * To change this template file, choose Tools | Templates

 * and open the template in the editor.

 */


/**

 *

 * @author Jacob Samuel

 */


import javax.swing.*;  

import java.text.DecimalFormat;


public class Kilograms_Pounds extends javax.swing.JFrame {


    /**

     * Creates new form Kilograms_Pounds

     */

    public Kilograms_Pounds() {

        initComponents();

    }


    /**

     * This method is called from within the constructor to initialize the form.

     * WARNING: Do NOT modify this code. The content of this method is always

     * regenerated by the Form Editor.

     */

    @SuppressWarnings("unchecked")

    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          

    private void initComponents() {


        jLabel1 = new javax.swing.JLabel();

        jButton1 = new javax.swing.JButton();

        jTextField1 = new javax.swing.JTextField();

        jLabel2 = new javax.swing.JLabel();

        jTextField2 = new javax.swing.JTextField();

        jButton2 = new javax.swing.JButton();

        jButton3 = new javax.swing.JButton();


        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        setTitle("Kilograms To Pounds Using Swing in Java");


        jLabel1.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N

        jLabel1.setText("Pound Equivalent");


        jButton1.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N

        jButton1.setText("Convert");

        jButton1.setToolTipText("Click here to convert into pounds.");

        jButton1.setActionCommand("");

        jButton1.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                jButton1ActionPerformed(evt);

            }

        });


        jTextField1.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N


        jLabel2.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N

        jLabel2.setText("Give Kilogram Value");


        jTextField2.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N


        jButton2.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N

        jButton2.setText("Clear");

        jButton2.setToolTipText("Click here to clear the text box.");

        jButton2.setActionCommand("");

        jButton2.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                jButton2ActionPerformed(evt);

            }

        });


        jButton3.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N

        jButton3.setText("Quit");

        jButton3.setToolTipText("Click here to quit program.");

        jButton3.setActionCommand("");

        jButton3.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                jButton3ActionPerformed(evt);

            }

        });


        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());

        getContentPane().setLayout(layout);

        layout.setHorizontalGroup(

            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

            .addGroup(layout.createSequentialGroup()

                .addGap(32, 32, 32)

                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

                    .addComponent(jLabel2)

                    .addComponent(jLabel1)

                    .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE))

                .addGap(18, 18, 18)

                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

                    .addGroup(layout.createSequentialGroup()

                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

                            .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)

                            .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE))

                        .addContainerGap(147, Short.MAX_VALUE))

                    .addGroup(layout.createSequentialGroup()

                        .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)

                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

                        .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)

                        .addGap(18, 18, 18))))

        );

        layout.setVerticalGroup(

            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

            .addGroup(layout.createSequentialGroup()

                .addGap(49, 49, 49)

                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

                    .addComponent(jLabel2)

                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

                .addGap(18, 18, 18)

                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

                    .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

                    .addComponent(jLabel1))

                .addGap(42, 42, 42)

                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

                    .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)

                    .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)

                    .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE))

                .addContainerGap(89, Short.MAX_VALUE))

        );


        pack();

        setLocationRelativeTo(null);

    }// </editor-fold>                        


    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         

        // TODO add your handling code here:

        DecimalFormat f = new DecimalFormat("##.00");

             if (evt.getSource().equals(jButton1)) {


           double kilograms =  Double.parseDouble(jTextField1.getText());

        

           double pound = kilograms * 2.20462262;

           jTextField2.setText(String.valueOf(f.format(pound))+ " lbs");

           jTextField2.setEditable(false);

         


        }

    }                                        


    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                         

        // TODO add your handling code here:

         if (evt.getSource().equals(jButton2)) {

              jTextField1.setText("");

              jTextField2.setText("");

              jTextField1.requestFocus();


        }

    }                                        


    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {                                         

        // TODO add your handling code here:

            if (evt.getSource().equals(jButton3)) {

        

                     

    int confirmed = JOptionPane.showConfirmDialog(null, "Exit Program?","Quit Program",JOptionPane.YES_NO_OPTION);

    if(confirmed == JOptionPane.YES_OPTION)

    {

        dispose();

    }

} else {

            

     setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

       }

    }                                        


    /**

     * @param args the command line arguments

     */

    public static void main(String args[]) {

        /* Set the Nimbus look and feel */

        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">

        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.

         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 

         */

        try {

            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {

                if ("Nimbus".equals(info.getName())) {

                    javax.swing.UIManager.setLookAndFeel(info.getClassName());

                    break;

                }

            }

        } catch (ClassNotFoundException ex) {

            java.util.logging.Logger.getLogger(Kilograms_Pounds.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

        } catch (InstantiationException ex) {

            java.util.logging.Logger.getLogger(Kilograms_Pounds.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

        } catch (IllegalAccessException ex) {

            java.util.logging.Logger.getLogger(Kilograms_Pounds.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

        } catch (javax.swing.UnsupportedLookAndFeelException ex) {

            java.util.logging.Logger.getLogger(Kilograms_Pounds.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

        }

        //</editor-fold>


        /* Create and display the form */

        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {

                new Kilograms_Pounds().setVisible(true);

            }

        });

    }


    // Variables declaration - do not modify                     

    private javax.swing.JButton jButton1;

    private javax.swing.JButton jButton2;

    private javax.swing.JButton jButton3;

    private javax.swing.JLabel jLabel1;

    private javax.swing.JLabel jLabel2;

    private javax.swing.JTextField jTextField1;

    private javax.swing.JTextField jTextField2;

    // End of variables declaration                   

}