Categories
Java

Asterisk Triangle in Java

 A simple program that will ask the user to give a number and then the program will generate the asterisk triangle using 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 in my email address also. Thank you.

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

Program Listing

/* Asterisk.java
 * Author : Jake Rodriguez Pomperada, MAED-IT, MIT
 * April 5, 2021   8:13 PM
 * www.jakerpomperada.blogspot.com
 * www.jakerpomperada.com
 * jakerpomperada@gmail.com
 * Bacolod City, Negros Occidental
 */ 

import java.util.Scanner;

public class Asterisks {
	 public static void main(String[] args) {
	        Scanner scan = new Scanner(System.in);
	        
	        System.out.println();
	        System.out.print("\tAsterisk Triangle in Java");
	        System.out.println("\n");
	        System.out.print("\tEnter a number: ");
	        int number = scan.nextInt();
	        int res;
	        System.out.println("\n");
	        for (int a=1; a<=number; a++) {
	        	 System.out.print("\t");
	            res = number - a;
	            for (int b=0; b<=res;b++) {
	                System.out.print("*");
	            }
	            System.out.println("");
	        }
	    }
}
Categories
Java

Shopping Discount in Java

  Machine Problem

 A departmental store offers 20% discount on shopping of 10,000 PRs. 10% discount on shopping of 5000 PRs. and no discount on shopping of less than 5000 PRs. Write a program that accepts total bill of buyer as input and calculates amount to be paid after applying discount.  Use separate functions for input, calculate discount and display total bill after discount.(java)

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 in my email address also. Thank you.

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

Program Listing

/* DepartmentStore.java
 * Mr. Jake R. Pomperada, MAED-IT, MIT
 * jakerpomperada.com and jakerpomperada.blogspot.com
 * jakerpomperada@gmail.com
 * Bacolod City, Negros Occidental
 * 
 * Machine Problem
 * 
 * A departmental store offers 20% discount on shopping of 10,000 PRs. 10% discount on
*shopping of 5000 PRs. and no discount on shopping of less than 5000 PRs. Write a program that 
*accepts total bill of buyer as input and calculates amount to be paid after applying discount.
 Use separate functions for input, calculate discount and display total bill after discount.(java)
 */

import java.util.Scanner;

public class DepartmentStore {
	
	  public static void main(String[] args) {
	        Scanner sc = new Scanner(System.in);
	        System.out.println("\n");
		    System.out.print("\t\tShopping Discount in Java");
		    System.out.println("\n");
	        System.out.print("\tEnter total amount: ");
	        double amount = sc.nextDouble();
	        double total = 0;

	        if(amount >= 10000) {
	            total = amount - (amount * 0.20);
	            System.out.println("\tBill is eligible for a 20% discount");
	        } else if (amount < 10000 && amount >= 5000) {
	            total = amount - (amount * 0.10);
	            System.out.println("\tBill is eligible for a 10% discount");
	        } else {
	            total = amount;
	            System.out.println("\tBill is not eligible for a any discount");
	        }

	        System.out.println("\tYour total bill is: " + total);
	        sc.close();
	        System.out.println();
	        System.out.print("\t THANK YOU FOR USING THIS PROGRAM");
	        System.out.println("\n");
	    }

}