Sunday, October 16, 2016

Product Bill Calculator in C#

Here is a sample program that I wrote in C# that will ask the user to give the product name, product quantity and product price and then our program will compute for the total cost of the product. What is good about this program is that I added a function that will prompt and ask the user do you want to continue using this program or not which enables the user to repeat the program running again and able to provide new values in a the other product. I hope you will find my work useful. Thank you.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My mobile number here in the Philippines is 09173084360.




Sample Program Output

Program Listing

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

// October 16, 2016  Sunday
// Author : Mr. Jake R. Pomperada, MAED-IT
// Program to compute bill given price and quantity

namespace bill_solver
{
    class bill
    {
        static void Main(string[] args)
        {
            string product_name, reply;
            int quantity = 0,n=0;
            double price = 0, amount = 0;
            
        do {
            Console.Clear();
            Console.Write("Product Bill Calculator");
            Console.Write("\n\n");
            Console.Write("Enter Product Name      : ");
            product_name = Console.ReadLine();
            Console.Write("Enter Quantity          : ");
            quantity = Convert.ToInt32(Console.ReadLine());
            Console.Write("Enter Product Price Php : ");
            price = Convert.ToDouble(Console.ReadLine());

            amount = (quantity * price);

            Console.Write("\n\n");
            Console.Write("===== DISPLAY RESULTS =====");
            Console.Write("\n\n");
            Console.WriteLine("Product          :  {0}.", product_name);
            Console.WriteLine("Price            :  {0:0.00}.", price);
            Console.WriteLine("Quantity         :  {0}.", quantity);
            Console.Write("\n\n");
            Console.WriteLine("Total Cost       : Php {0:0.00}.", amount);
            Console.Write("\n\n");
            Console.Write("Do You Want To Continue? Y/N : ");
            reply = Console.ReadLine();

            if (reply == "y" || reply == "Y")
            {
                continue;
            }
            else if (reply == "n" || reply == "N")
            {
                Console.Write("\n\n");
                Console.Write("Thank You For Using This Software.");
                Console.Write("\n\n");
                break;
            }
           
        } while (n == 0);
        Console.ReadLine();
        } 
    }
}



Saturday, October 15, 2016

Basic User Input in C#

This simple program will show you basic input and output operations in Microsoft C# programming language.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My mobile number here in the Philippines is 09173084360.




Sample Program Output

Program Listing

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace basic_user_input
{
    class user_input
    {
        static void Main(string[] args)
        {
            string name;
            int age=0;
            double height=0;

            Console.Write("Basic User Input in C# ");
            Console.Write("\n\n");
            Console.Write("What is your name : ");
            name = Console.ReadLine();
            Console.Write("What is your age  : ");
            age = Convert.ToInt32(Console.ReadLine());
            Console.Write("What is your height in Centimeter(s) : ");
            height = Convert.ToDouble(Console.ReadLine());

            //Print a blank line
            Console.WriteLine();

            //Show the details you typed
            Console.Write("\n\n");
            Console.Write("===== DISPLAY REPORT =====");
            Console.Write("\n\n");
            Console.WriteLine("Name is {0}.", name);
            Console.WriteLine("Age is {0}.", age);
            Console.WriteLine("Height is {0}.", height);
            Console.Write("\n\n");
            Console.Write("End of Program");
            Console.ReadLine();
        }
    }
}




Seconds To Hours, Minutes and Seconds in C#

A very simple program that I wrote using C# as my programming language that will ask the user to give time in seconds and then our program will converted the given time in hours, minutes and seconds.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My mobile number here in the Philippines is 09173084360.




Sample Program Output

Program Listing

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace time_conversion
{
    class time_check
    {
        static void Main(string[] args)
        {
            long v,sec,hr,min; 

            Console.Write("Time Converter Converter");
            Console.Write("\n\n");
            Console.Write("Enter Time in Seconds   : ");
            sec = Convert.ToInt32(Console.ReadLine());

            hr=sec/3600; 
            v=sec%3600; 
            min=v/60; 
            sec=v%60; 

            Console.Write("\n\n");
            Console.Write("===== DISPLAY REPORT =====");
            Console.Write("\n\n");
            Console.WriteLine(" Time in hour:min:sec is: {0}:{1}:{2}." ,hr,min,sec);
            Console.Write("\n\n");
            Console.Write("End of Program");
            Console.ReadLine();
        }
    }
}








Loan Interest Solver in C# Using Console

Here is a simple program that I wrote using Microsoft C# programming language that will compute for the interest to be paid by the customer to the loan that he or she acquire from a bank or a lending institution. What does our program will do is to ask the user to give the principal amount being borrowed, second our program will ask the rate of interest and finally the third our program will ask time refers to the number of years the loan amount should be paid of by the borrower. The code is very simple and easy to understand.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My mobile number here in the Philippines is 09173084360.




Sample Program Output

Program Listing

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace loan_solve_problem
{
    class loan_solver
    {
        static void Main(string[] args)
        {
            double amount=0, rate=0, time=0, solve_interest=0;

            Console.Write("Loan Interest Solver");
            Console.Write("\n\n");
            Console.Write("Enter Principal Amount    : ");
            amount = Convert.ToDouble(Console.ReadLine());
            Console.Write("Enter Rate of Interest    : ");
            rate = Convert.ToDouble(Console.ReadLine());
            Console.Write("Enter Period of Interest  : ");
            time  = Convert.ToDouble(Console.ReadLine());
              
            solve_interest = (amount * rate * time) / 100;

            Console.Write("\n\n");
            Console.Write("===== DISPLAY REPORT =====");
            Console.Write("\n\n");
            Console.WriteLine("The Interest is Php {0:0.00}.", solve_interest);
            Console.Write("\n\n");
            Console.Write("End of Program");
            Console.ReadLine();
        }
    }
}





Student Grade Solver in C# Using Console


Here is a sample program that I wrote using C# as my programming language that will ask the user to give the student name, subject, prelim, midterm and endterm grade and then our program will compute for the final grade of the student using C# in console environment.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My mobile number here in the Philippines is 09173084360.




Sample Program Output

Program Listing

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace student_grade_solver
{
    class grade_solve
    {
        static void Main(string[] args)
        {
            string student_name, subject;
            double prelim = 0, midterm = 0, endterm = 0;
            double final_grade = 0;
           
            Console.Write("Student Grade Solver");
            Console.Write("\n\n");
            Console.Write("Student Name    : ");
            student_name = Console.ReadLine();
            Console.Write("Subject         : ");
            subject = Console.ReadLine();
            Console.Write("Prelim Grade    : ");
            prelim = Convert.ToDouble(Console.ReadLine());
            Console.Write("Midterm Grade   : ");
            midterm = Convert.ToDouble(Console.ReadLine());
            Console.Write("Endterm Grade   : ");
            endterm = Convert.ToDouble(Console.ReadLine());

            final_grade = (prelim * 0.2) + (midterm * 0.3) + (endterm * 0.5); 

            Console.Write("\n\n");
            Console.Write("===== DISPLAY REPORT ====="); 
            Console.Write("\n\n");
            Console.WriteLine(" Student Name  :  {0}. ",student_name);
            Console.WriteLine(" Subject       :  {0}. ",subject);
            Console.WriteLine(" Final Grade   :  {0:0}.",final_grade);
            Console.Write("\n\n");
            Console.Write("End of Program");
            Console.ReadLine();
        }
    }
}




Celsius To Fahrenheit Converter in C#

A simple console program that I wrote in C# that will ask the user temperature in Celsius and then it will convert to Fahrenheit temperature equivalent. 

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My mobile number here in the Philippines is 09173084360.




Sample Program Output


Program Listing

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace temperature
{
    class temp_solver
    {
        static void Main(string[] args)
        {
            double celsius=0,solve_fahrenheit=0;

            Console.Write("Celsius To Fahrenheit Converter");
            Console.Write("\n\n");
            Console.Write("Enter Temperature in Celsius   : ");
            celsius = Convert.ToDouble(Console.ReadLine());

            solve_fahrenheit = (1.8 * celsius) + 32;

            Console.Write("\n\n");
            Console.Write("===== DISPLAY REPORT =====");
            Console.Write("\n\n");
            Console.WriteLine("The Temperature in Fahrenheit is {0:0.00}.", solve_fahrenheit);
            Console.Write("\n\n");
            Console.Write("End of Program");
            Console.ReadLine();
        }
    }
}






Sum of Two Numbers in C# Using Console

A very simple program that I wrote using Microsoft C# programming language that will accept two integer input values from the user and then our program will add the sum of the two input values using console environment in C#.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 


My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My mobile number here in the Philippines is 09173084360.




Sample Program Output

Program Listing

add.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace add
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, sum;
            Console.Write("Sum of Two Numbers in C# Using Console");
            Console.Write("\n\n");
            Console.Write("Enter the first number : ");
            a = Convert.ToInt32(Console.ReadLine());
            Console.Write("Enter second number : ");
            b = Convert.ToInt32(Console.ReadLine());
            sum = a + b;
            Console.Write("\n\n");
            Console.WriteLine("The sum of {0} and {1} is {2}.", a,b,sum);
            Console.Write("\n\n");
            Console.Write("End of Program");
            Console.ReadLine();
        }
    }
}







Compute the Area of the Circle in Java

Here is one of the oldest code in Java when I start learning how to program on it to compute the area of the circle in this example I am still using buffered reader in order to accept input values from the user.

Add me at Facebook my addressis jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 


My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My mobile number here in the Philippines is 09173084360.


Program Listing

import java.io.*;

public class area_circle {

public static void main(String [] args) throws Exception
{
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
int radius=0;
double pi, area;
System.out.println("Compute Area of a Circle\n");
System.out.print("Enter a value for radius: ");
radius = Integer.parseInt(input.readLine());
pi = 3.1416;
area = (pi * (radius * radius));
System.out.println("\nThe value for radius is: " + radius);
System.out.println("\nThe value for pi is: " + pi);
System.out.println("\nThe area of a circle is: " + area + "\n\n\n" );
System.out.println("\n\n\n" );
System.out.println("End of Program" );
}
}

Addition of Two Numbers in Ruby

A very simple program that I wrote using Ruby as my programming language that will ask the user to give two numbers and then our program will compute for the sum of the two numbers.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My mobile number here in the Philippines is 09173084360.


Program Listing


print "\n\n";
print "Sum of Two Numbers in Ruby"
print "\n\n";
print "enter number 1 : ";
val1 = gets;
print "enter number 2 : ";
val2 = gets;

val1 = val1.to_i
val2 = val2.to_i

sum = sum.to_i

sum = (val1 + val2)

print "\n\n";
puts "The sum of #{val1} and #{val2} is #{sum}."
print "\n\n";
print "End of Program";
print "\n\n";


Product of Two Numbers in Ruby

A very simple program that I wrote using Ruby as my programming language that will ask the user to give two numbers and then our program will compute for the product of the two numbers.

Add me at Facebook my addressis jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My mobile number here in the Philippines is 09173084360.



Program Listing

print "\n\n";
print "Product of Two Numbers in Ruby"
print "\n\n";
print "enter number 1 : ";
val1 = gets;
print "enter number 2 : ";
val2 = gets;

val1 = val1.to_i
val2 = val2.to_i

product = product.to_i

product = (val1 * val2)

print "\n\n";
puts "The product of #{val1} and #{val2} is #{product}."
print "\n\n";