What's new

Help pseudocode to java

Heathcliff

Forum Veteran
Elite
Joined
May 22, 2015
Posts
1,194
Solutions
101
Reaction
1,211
Points
601
Hello po pwede po patulong maconvert ung pseudocode into java di po kasi kami tinuturuan nung prof namin sa java Capture+_2019-12-08-13-06-57.pngCapture+_2019-12-08-13-07-24.pngCapture+_2019-12-08-13-07-44.pngCapture+_2019-12-08-13-08-01.pngCapture+_2019-12-08-13-10-04.pngCapture+_2019-12-08-13-11-13.pngCapture+_2019-12-08-13-19-31.png
Galing po sa FE ITPEC exam ung pinagagawa samin. Salamat po sa tutulong
 

Attachments

eto paps, pagaralan mong mabuti,
Java:
import java.util.*;
public class test2 {
static Scanner console = new Scanner(System.in);
    static void GetData() {
        //Process #1 (Receive the data entered by the user)
        System.out.println("Monthly Income: ");
        int MonthlyIncome = console.nextInt();
        System.out.println("Did you have a Spouse that is Working?(Y/N): ");
        String temp = console.next();
        char HaveSpouse = temp.charAt(0);
        System.out.println("Input how many children you have: ");
        int NumberofChildren = console.nextInt();
      
    Processor(MonthlyIncome, HaveSpouse, NumberofChildren);
    }
    //Output the processed data
    static void PutData(int AnnualIncome, int BasicExemption, int ExemptionForSpouse, int ExemptionForChildren,int IncomeToAssetTax,int IncomeTaxPerYear, int IncomeTaxPerMonth) {
    System.out.println("Annual Income: "+AnnualIncome);
    System.out.println("Basic Exemption: "+BasicExemption);
    System.out.println("Exemption for Spouse: "+ExemptionForSpouse);
    System.out.println("Exemption for Children: "+ExemptionForChildren);
    System.out.println("Income to Asset Tax:"+IncomeToAssetTax);
    System.out.println("Income Tax per Year: "+IncomeTaxPerYear);
    System.out.println("Income Tax per Month: "+IncomeTaxPerMonth);
}
    static void Processor(int MonthlyIncome, char HaveSpouse, int NumberofChildren) {
        //Process #2 (Calculates the annual income)
        int AnnualIncome = MonthlyIncome * 12; //Process 2d
        int BasicExemption = (int)(AnnualIncome * 0.2); //Process 2e
        int ExemptionForSpouse = 0; //Process 2f
        if(HaveSpouse == 'Y' || HaveSpouse == 'y')
        ExemptionForSpouse = 300; // The user have a wife
        int ExemptionForChildren = 200 * NumberofChildren; //Process 2g
        int IncomeToAssetTax = AnnualIncome - BasicExemption - ExemptionForSpouse - ExemptionForChildren; //Process 2h
        //Process #3 (Calculates the Income Tax)
        //Initialze the things needed for the table
        int[] Amount = {500,500,500,500,1000,1000,2000,2000,2000,5000,5000};
        int[] TaxRate = {1,2,3,4,5,6,7,8,10,12,15,20};
        int[] AllocatedIncome = new int[12];
        int[] TaxToPay = new int[12];
        AllocatedIncome[0] = IncomeToAssetTax;
        int IncomeTaxPerYear = 0;
        if(IncomeToAssetTax > 500) {
            for(int i = 0; i < 11 && AllocatedIncome[i] > 0; i++) {
                if(AllocatedIncome[i] > Amount[i]) {
                    AllocatedIncome[i+1] = AllocatedIncome[i] - Amount[i];
                    AllocatedIncome[i] = Amount[i];
                }
                if(i < 12 && AllocatedIncome[i] > 0) {
                TaxToPay[i] = (int) AllocatedIncome[i] * TaxRate[i] / 100;
                IncomeTaxPerYear = IncomeTaxPerYear + TaxToPay[i];
                }
            }
        }
        int IncomeTaxPerMonth = IncomeTaxPerYear / 12;
        PutData(AnnualIncome, BasicExemption, ExemptionForSpouse, ExemptionForChildren, IncomeToAssetTax, IncomeTaxPerYear, IncomeTaxPerMonth);
    }
    ////Driver to start the program
    public static void main(String[] args) {
    GetData();
    }
}
 
eto paps, pagaralan mong mabuti,
Java:
import java.util.*;
public class test2 {
static Scanner console = new Scanner(System.in);
    static void GetData() {
        //Process #1 (Receive the data entered by the user)
        System.out.println("Monthly Income: ");
        int MonthlyIncome = console.nextInt();
        System.out.println("Did you have a Spouse that is Working?(Y/N): ");
        String temp = console.next();
        char HaveSpouse = temp.charAt(0);
        System.out.println("Input how many children you have: ");
        int NumberofChildren = console.nextInt();
     
    Processor(MonthlyIncome, HaveSpouse, NumberofChildren);
    }
    //Output the processed data
    static void PutData(int AnnualIncome, int BasicExemption, int ExemptionForSpouse, int ExemptionForChildren,int IncomeToAssetTax,int IncomeTaxPerYear, int IncomeTaxPerMonth) {
    System.out.println("Annual Income: "+AnnualIncome);
    System.out.println("Basic Exemption: "+BasicExemption);
    System.out.println("Exemption for Spouse: "+ExemptionForSpouse);
    System.out.println("Exemption for Children: "+ExemptionForChildren);
    System.out.println("Income to Asset Tax:"+IncomeToAssetTax);
    System.out.println("Income Tax per Year: "+IncomeTaxPerYear);
    System.out.println("Income Tax per Month: "+IncomeTaxPerMonth);
}
    static void Processor(int MonthlyIncome, char HaveSpouse, int NumberofChildren) {
        //Process #2 (Calculates the annual income)
        int AnnualIncome = MonthlyIncome * 12; //Process 2d
        int BasicExemption = (int)(AnnualIncome * 0.2); //Process 2e
        int ExemptionForSpouse = 0; //Process 2f
        if(HaveSpouse == 'Y' || HaveSpouse == 'y')
        ExemptionForSpouse = 300; // The user have a wife
        int ExemptionForChildren = 200 * NumberofChildren; //Process 2g
        int IncomeToAssetTax = AnnualIncome - BasicExemption - ExemptionForSpouse - ExemptionForChildren; //Process 2h
        //Process #3 (Calculates the Income Tax)
        //Initialze the things needed for the table
        int[] Amount = {500,500,500,500,1000,1000,2000,2000,2000,5000,5000};
        int[] TaxRate = {1,2,3,4,5,6,7,8,10,12,15,20};
        int[] AllocatedIncome = new int[12];
        int[] TaxToPay = new int[12];
        AllocatedIncome[0] = IncomeToAssetTax;
        int IncomeTaxPerYear = 0;
        if(IncomeToAssetTax > 500) {
            for(int i = 0; i < 11 && AllocatedIncome[i] > 0; i++) {
                if(AllocatedIncome[i] > Amount[i]) {
                    AllocatedIncome[i+1] = AllocatedIncome[i] - Amount[i];
                    AllocatedIncome[i] = Amount[i];
                }
                if(i < 12 && AllocatedIncome[i] > 0) {
                TaxToPay[i] = (int) AllocatedIncome[i] * TaxRate[i] / 100;
                IncomeTaxPerYear = IncomeTaxPerYear + TaxToPay[i];
                }
            }
        }
        int IncomeTaxPerMonth = IncomeTaxPerYear / 12;
        PutData(AnnualIncome, BasicExemption, ExemptionForSpouse, ExemptionForChildren, IncomeToAssetTax, IncomeTaxPerYear, IncomeTaxPerMonth);
    }
    ////Driver to start the program
    public static void main(String[] args) {
    GetData();
    }
}
maraming salamat po sir! pagaralan ko po yan
 
No need to wait for your prof to teach you Java.

Your best bet is to research Java online (like what you are doing here in the forums) but also take a look at the online articles and tutorials and videos (i.e in YøùTùbé).
 
[XX='Ivan henyo, c: 328804, m: 505439'][/XX]

Honestly, yes. If I can only go back in time, I will. But the problem in the Philippines is you need PAPERS to have a job. In fact, I always make a joke in order to be a janitor you need to be good looking, young, and with masters degree.
 
and thats the truth yan nangyayari sa college life ko ngayun hahaha useless may nagsabi panga multi millionaire kung ang isang libro nayan pinag aralan ng skwelahan na pagaaralan mo sa apat na taon mas mabuti kung bilhin mo nalang 1 time kung ang presyo 5000 or what keysa 4 na taon na gastos sa tuition naka mura ka pa , sipag basa apply unawa lang kailangan .financial liability talaga ang pag aaral kadalasan wala ng prof na nagtuturo dahil sa kagustuhan nila kundi dahil dito $ pede naman ata maging successful kahit walang papel sabi panga niya diploma is a piece of a toilet paper na train kasi tayu ng mga magulang natin maging employee/worker sa lahat ng ating buhay kaya ang iba mindset nila pag walang pinag aralan mahirap di naman natatapos education mo kung tumigil ka sa pag aaral sabi pa nga niya the real education magsisimula when you step out the door andami ng kaparaanan maging successful/magkapera like YøùTùbér di naman ata lahat ng YøùTùbér eh nakapagtapos ng pagaaral di naman ata hinahanapan ng papel kung mag youYøùTùbé ka ? crypto trading di naman tinuturo sa mga skwelahan yan Affilaite marketing Online selling higit sa lahat (debt) at iba pa Thats why i dont want to an Become E in Cashflow Quadrant kung interesado ka bumasa try mo basahin libro nato (RichDad Poor Dad) by robert kiyosaki .
I dont want to work with my whole life use debt to make money.
wala na silbi papel para lang sa mga average people lang yan nowadays it doesnt matter
whats matter God+Family+Happiness+Money+time your dream
All of that paper will work to their boss then make boss richer

Watch him
 

Similar threads

Back
Top