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

Need some help creating Pseudocode and then creating Java code to run the progra

ID: 3781592 • Letter: N

Question

Need some help creating Pseudocode and then creating Java code to run the program to know when to reorder fruit supplies when stock is running low.

Overview:

This assignment will allow you to use pseudocode to implement the program to see the value in planning first, coding later.

While coding is the glamorous part of the job, software development is a process with many steps.

The program itself will focus on operators to complete an equation. Prompt:

Before completing this assignment, be sure to review the Module Two resources.

Use the Guide to Pseudocode document to write out the pseudocode for the given problem:

Imagine that you are a merchant and need to keep better tabs on your merchandise to know when to reorder supplies.

First, write out pseudocode, and then create a pr ogram to help you by accomplishing the following tasks:

Use a dialog box to ask the user to input the following. (You will need to convert this from a string to an integer.)

How many apples are on hand

How many apples should be in stock

How many oranges are on hand

How many oranges should be in stock

Perform an operation to determine how many of each item should be ordered to maintain the stock

.

Use a dialog box to output the number of apples and oranges that need to be ordered.

Once you have the program laid out, build it by creating a functional program. Use your pseudocode as a guide. Be sure to

remember the following important items.Follow the style guidelines found in ZyBooks as you develop

.

Use commenting to describe the code

.

Practice debugging if you encounter errors

.

Ensure your program performs its intended function

.

Specifically, the following critical elements must be addressed:

I.

Documentation:

Pseudocode

:

Break down the problem statement into programming terms through creation of pseudocode following the guidelines provided in the course.

II.

Functioning Code:

Produce fully functioning code (a code that produces no errors) that aligns with the accompanying annotations.

III.

Code Results: Results are properly generated.

A.

Code results generate accurate output

.

B.

Code results produce results that are streamlined,efficient, and error free.

IV.

Comments:

All code should be well - commented. This is a practiced art that requires striking a balance between commenting everything, which adds a great deal of unneeded noise to the code, and commenting nothing. A. Explain the purpose of lines or sections of your code, detailing the approach and method the programmer took to achieve a specific task in the code.

V. Style and Structure:Part of the lesson to be learned in this course is how to write code that is clearly readable and formatted in an organized manner.

A. Develop logically organized code that can be modified and maintained.

B.Utilize proper syntax , style, and language conventions and best practices. Guidelines for Submission: Submit your pseudocode as a DOC or DOCX file. Submit the program as a JAVA file.

Explanation / Answer

import javax.swing.JOptionPane;

class Stock
{
public static void main(String arg[])
{
    int appleInHand,appleStockReq,orangeInHand,orangeStockReq;
    JOptionPane jp = new JOptionPane();

    appleInHand = Integer.parseInt(jp.showInputDialog(null,"How many apples are in hand ?","Apple in hand",JOptionPane.QUESTION_MESSAGE)); //Accepting input from user for apples in hand
    appleStockReq = Integer.parseInt(jp.showInputDialog(null,"How many apples should be in stock ?","Apple in stock",JOptionPane.QUESTION_MESSAGE)); //Accepting input from user for apples to be in stock
    orangeInHand = Integer.parseInt(jp.showInputDialog(null,"How many oranges in hand ?","Orange in hand", JOptionPane.QUESTION_MESSAGE)); //Accepting input from user for oranges in hand
    orangeStockReq = Integer.parseInt(jp.showInputDialog(null,"How many oranges should be in stock ?","Orange in stock", JOptionPane.QUESTION_MESSAGE)); //Accepting input from user for orangess to be in stock

    if(appleInHand<appleStockReq) //comparing number of apples in hand and apples in stock
    {
        int appleToBeOrdered = order(appleStockReq, appleInHand);
        jp.showMessageDialog(null,"Number of Apples to be ordered :"+appleToBeOrdered,"Order", JOptionPane.PLAIN_MESSAGE);
    }
   else
       jp.showMessageDialog(null,"Reordering is not required :","Order",JOptionPane.PLAIN_MESSAGE);

    if(orangeInHand<orangeStockReq) //comparing number of orangesin hand and orangesin stock
   {
       int orangeToBeOrdered = order(orangeStockReq, orangeInHand);
       jp.showMessageDialog(null,"Number of Orangees to be ordered :"+orangeToBeOrdered,"Order", JOptionPane.PLAIN_MESSAGE);
   }
   else
    jp.showMessageDialog(null,"Reordering is not required:","Order",JOptionPane.PLAIN_MESSAGE);

}

//method to calculate number of apples or oranges to be ordered
public static int order(int stockReq , int inHand )
{
        int orderQuantity = stockReq - inHand;
           return orderQuantity;
}

}

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