Write a program to input a character and check whether it is a vowel or lowercase or uppercase or a digit or any other special character.
Answers
Answer:
Input: ch = 'A'
Output: A is an UpperCase character
Input: ch = 'a'
Output: a is an LowerCase character
Input: ch = '0'
Output: 0 is not an aplhabetic character
Hope you will like it
Mark my answer as brainlist
Answer:package abb;
/**
* Write a description of class abby here.
*
* @author (your name)
* @version (a version number or a date)
*/
import java.util.Scanner;
public class abby
{
public static void main()
{
Scanner abby = new Scanner (System.in);
String product;
int price, quality, total, cash, change, thousand, fivehundred, twohundred,
hundred, fifty, twenty, ten, five, one, mithousand, mifivehundred,
mitwohundred, mihundred, mififty, mitwenty, miten, mifive, mione, kathousand,
kafivehundred, katwohundred, kahundred, kafifty, katwenty, katen, kafive, kaone, bills, coins;
System.out.print("\nPlease input a product: ");
product=abby.nextLine();
System.out.print("\n Please enter the price: ");
price=abby.nextInt();
System.out.print("\n Quality to be punchased: ");
quality=abby.nextInt();
total = price*quality;
System.out.print("\n The amount to be paid is: "+total);
System.out.print("\n Input the amount to be tendered: ");
cash=abby.nextInt();
change = cash-total;
thousand = change/1000;
mithousand = thousand*1000;
kafivehundred = change%1000;
fivehundred = kafivehundred/500;
mifivehundred= fivehundred*500;
katwohundred = change%1000%500;
twohundred = katwohundred/200;
mitwohundred = twohundred*200;
kahundred = change%1000%500%200;
hundred = kahundred/1000;
mihundred = hundred*100;
kafifty = change%1000%5005200%100;
fifty = kafifty/50;
mififty = fifty*50;
katwenty = change%1000%500%200%100%50;
twenty = katwenty/20;
mitwenty = twenty*20;
katen = change%1000%500%200%100%50%20;
ten = katen/10;
miten = ten*10;
kafive = change%1000%500%200%100%50%20%10;
five = kafive/5;
mifive = five*5;
kaone = change%1000%500%200%100%50%20%10%5;
one = kaone/1;
mione = one*1;
bills = thousand+fivehundred+twohundred+hundred+fifty+twenty;
coins = ten+five+one;
if (change<0)
{
System.out.print("you have insufficient cash.");
}
else if (change>0)
{
System.out.print("\nYour change is: ");
System.out.print("\n1000's:\t"+thousand+"\t=>\t"+mithousand);
System.out.print("\n500's:\t"+fivehundred+"\t=>\t"+mifivehundred);
System.out.print("\n200's:\t"+twohundred+"\t=>\t"+mitwohundred);
System.out.print("\n100's:\t"+hundred+"\t=>\t"+mihundred);
System.out.print("\n50's:\t"+fifty+"\t=>\t"+mififty);
System.out.print("\n20's:\t"+twenty+"\t=>\t"+mitwenty);
System.out.print("\n10's:\t"+ten+"\t=>\t"+miten);
System.out.print("\n5's:\t"+five+"\t=>\t"+mifive);
System.out.print("\n1's:\t"+one+"\t=>\t"+mione);
System.out.print("\n\t========\t========");
System.out.print("\nTotal:\t"+bills+"bill/s\t"+coins+" coin/s\t");
System.out.print("Your change is:"+change);
}
else
{
System.out.print("Your change is:"+change);
}
abby.close();
}
}
Explanation: