Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Implement a java program from the pseudocode GetTransNumber. { Input transNum. }

ID: 3833078 • Letter: I

Question

Implement a java program from the pseudocode

GetTransNumber.

{

            Input transNum.

}

GetTransDetails.

{

            Input transType, transAmt.

}

CalcInterest.

{

            If(supplierMonthlyPymts <balForward)

            {

                        interest = yrInterest/12 * currentBal.

            }

            Else

            {

                        interest = 0.

            }

}

CalcBalances.

{

            overallSuppPurs = overallSuppPurs + supplierMonthlyPur.

            overallSuppPymts = overallSuppPymts + supplierMonthlyPymts.

            finalMonthlyBal = currentBal + intrest.

            overallFinalBal = overallFinalBal + finalMonthlyBal.

}

UpdateLow.

{

            If(finalMonthlyBal < lowSuppFinalMonthlyBal)

            {

                        lowSuppFinalMonthlyBal = finalMonthlyBal.

                        lowSuppName = supplierName.

            }

}

DisplaySuppBalances.

{

            Output finalMonthlyBal, supplierMonthlyPur, supplierMonthlyPymts.

}

CalcAverage.

{

            avePursPerSupplier = overallSuppPurs / supplierCtr.

}

DisplaySummary.

[

            Output date, overallFinalBal, overallSuppPurs, overallSuppPymts.

            Output avePursPerSupplier, lowSuppFinalMonthlyBal, lowSuppName.

}

Explanation / Answer

The following pseodo code has been converted into java code. Please find the java code.

There is an error for two functions :GetTransDetails() and GetSupplierDetails() as u have not specified in which data type to return it. You can comment below if you want to know anything else

The code is:

package chegg;

import java.sql.Date;

public class supplier {
  
   String supplierName;
   int supplierCtr;
   double overallSuppPurs;
   double overallSuppPymts;
   int lowSuppFinalMonthlyBal;
   Date date;
   int transNum;
   int currentBal;
   int transAmt;
   int supplierMonthlyPur;
   String transType;
   int interest;
   double supplierMonthlyPymts;
   int transNumber;
   int balForward;
   int finalMonthlyBal;
   int yrInterest;
   int overallFinalBal;
   String lowSuppName;
   double avePursPerSupplier;
  
  
   public static void main()
   {
       supplier supplier=new supplier();
      
   }
  
   public void InitializeReport()
   {
       supplierName="Let’sgo!";
       supplierCtr=0;
       overallSuppPurs=overallSuppPymts= 0.0;
   lowSuppFinalMonthlyBal=250000;
      
   }
  
   public Date getDate()
   {
       return date;
   }
  
   public void ProcessSupplier()
   {
       InitSupplier();
       String suplierName=GetSupplierName();
       if(!suplierName.equalsIgnoreCase("Done"))
       {
           supplierCtr=supplierCtr+1;
           GetSupplierDetails();
           DisplaySummary();
           UpdateCurrentBal();
           while (transNum != 0)
           {
               ProcessTrans();
           }
           CalcInterest();
           CalcBalances();
           UpdateLow();
           DisplaySuppBalances();
              
       }
   }
  
   public void InitSupplier()
   {
       int supplierMonthlyPymts=0;
       int supplierMonthlyPur=0;
       int transNum=0;
   }
  
   public String GetSupplierName()
   {
       return supplierName;
   }
  
   public String GetSupplierDetails()
   {
      
   }
   public void UpdateCurrentBal()
   {
       currentBal = balForward;
   }
  
   public void ProcessTrans()
   {
       int transNumber=GetTransNumber();
       if(transNumber!=0)
       {
           GetTransDetails();
           UpdateTrans();
           DisplayTrans();
       }
      
   }
  
   public void UpdateTrans()
   {
       switch(transType)
       {
       case "B":
case "b":
currentBal = currentBal + transAmt;
supplierMonthlyPur = supplierMonthlyPur + transAmt;
break;
case "P":
case "p":
currentBal = currentBal - transAmt;
supplierMonthlyPymts = supplierMonthlyPymts + transAmt;
break;
       }
   }
  
   public void DisplayTrans()
   {
       System.out.println("transNum"+transNum);
       System.out.println("transType"+transType);
       System.out.println("transAmt"+transAmt);
       System.out.println("currentBal"+currentBal);
      
   }
  
   public int GetTransNumber()
   {
       return transNumber;
   }
  
   public supplier GetTransDetails()
   {
  
   }
   public void CalcInterest()
   {
       if(supplierMonthlyPymts < balForward)
{
interest = yrInterest/12 * currentBal;
}
       else
          
{
interest = 0;
}
   }
  
   public void CalcBalances()
   {
       overallSuppPurs = overallSuppPurs + supplierMonthlyPur;
   overallSuppPymts = overallSuppPymts + supplierMonthlyPymts;
   finalMonthlyBal = currentBal + interest;
   overallFinalBal = overallFinalBal + finalMonthlyBal;
   }
   public void UpdateLow()
   {
       if(finalMonthlyBal < lowSuppFinalMonthlyBal)
{
lowSuppFinalMonthlyBal = finalMonthlyBal;
lowSuppName = supplierName;
}
   }
  
   public void DisplaySuppBalances()
   {
       System.out.println("finalMonthlyBal"+finalMonthlyBal);
       System.out.println("supplierMonthlyPur"+supplierMonthlyPur);
       System.out.println("supplierMonthlyPymts"+supplierMonthlyPymts);
   }
  
   public void CalcAverage()
   {
       avePursPerSupplier = overallSuppPurs / supplierCtr;
      
   }
  
   public void DisplaySummary()
   {
       System.out.println("Date "+date);
       System.out.println("overallFinalBal "+overallFinalBal);
       System.out.println("overallSuppPurs "+overallSuppPurs);
       System.out.println("overallSuppPymts "+overallSuppPymts);
       System.out.println("avePursPerSupplier "+avePursPerSupplier);
       System.out.println("lowSuppFinalMonthlyBal "+lowSuppFinalMonthlyBal);
       System.out.println("lowSuppName "+lowSuppName);
      
   }

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote