TRENDING NEWS

POPULAR NEWS

Need Help Converting Pseudo-code To Java Code

I need help with these pseudocodes for java please help?

Well, just follow each through step-by-step, so for the first:


(initial values)
a = 1, b = 2, c = 5

(while)
a < c ? yes (loop)

(a = a + 1 and b = b + c)
a = 2, b = 7, c = 5

(while)
a < c ? yes (loop)

(a = a + 1 and b = b + c)
a = 3, b = 12, c = 5

(while)
a < c ? yes (loop)

(a = a + 1 and b = b + c)
a = 4, b = 17, c = 5

(while)
a < c ? yes (loop)

(a = a + 1 and b = b + c)
a = 5, b = 22, c = 5

(while)
a < c ? no (exit loop)

output 5, 22, 5


Just continue like that, stepping through the other problems.

HOW TO CONVERT THIS JAVA CODE TO PSEUDO CODE?

import java.util.Scanner;

public class SalesCommission
{

public static void main( String args[] )
{
SalesCommissionCalculator application = new SalesCommissionCalculator();

Scanner input = new Scanner( System.in );


// promt user for name
String name;
System.out.println("Please Enter you Name: ");
name = input.next();

// calculate sales for products
double gross = 0.0; // total gross sales
double earnings; // earnings made from sales
int product = 0; // the product number
int numberSold; // number sold of a given product

while ( product < 4 )
{
product++;

// prompt and read number of the product sold from user

System.out.printf( "Enter number sold of product #%d: ",
product );
numberSold = input.nextInt();

// determine gross of each individual product and add to total
if ( product == 1 )
gross += numberSold * 239.99;
else if ( product == 2 )
gross += numberSold * 129.75;
else if ( product == 3 )
gross += numberSold * 99.95;
else if ( product == 4 )
gross += numberSold * 350.89;
} // end loop

How do I convert code to pseudo code?

Manually, by writing it line by line as you read and understand the original code.That’s why you can’t automatically generate pseudo-code. No tool can understand code for you. No tool can interpret the meaning of code for you.However, if you can convince someone, who knows the programming language and is experienced in programming, to translate the code for you, then the job is done. Good luck finding someone who’ll do that for you without pay…

What tools can convert Java code into pseudo code?

Why on earth do you need to do this?A speculation might be that you have a need to write pseudocode but cannot do so for some reason, yet you have Java code that does what is required, so you want to convert the Java to pseudocode.Nevertheless, try:Java-2-Pseudohttps://www.varycode.com/converter.htmlHomeOr you can read about what is involved at:http://www.phontron.com/paper/fu...

Is there a tool that can convert Java code into Haskell code?

Try reading this article, it will help you. Applications and libraries/Interfacing other languages

What tool can convert Cobol into Java code?

Have you tried the J2C tooling in Rational Application developer?They can generate simple java beans from cobol copy book.Depending on your enterprise systems, cics, ims or others there are adapters where you can use  to communicate to back end system. Refer:http://publib.boulder.ibm.com/in...

I need help with these pseudocodes for java please help?

I don’t understand these pseudocode and what outputs they print.

What is output by each of the pseudocode segments?

d. j=2
k=5
n=9
While j < k
m=6
While m < n
Output “Goodbye”
m = m + 1
endwhile
j= j + 1




e. j=2
k=5
m= 6
n=9
While j < k
While m < n
Output “Hello”
m = m + 1
endwhile
j= j + 1
endwhile

Thank you,

Pseudocode currency conversion help please?

It has to be menu driven so design one as below

Currency program using pseudocode using 5 modules.

Main
Display Menu
Get International Value
Convert Currency
Display Results
From the Main module you're basically going to access the following 4 modules

Display Menu
Get International Value
Convert Currency
Display Results
You will need to write pseudocode to that will simulate a display menu

For example:

Declare continue as Boolean
Set continue = true
While continue = true
Display "Welcome to the international currency conversion program"
Display "Please make a selection"
Display "International Currency Types:"
Display "1: Canadian Dollars"
Display "2: Mexican Pesos"
Add pseudocode here for the rest of the currency types.

For the Get International Value module you will prompt for the international value
and do some check to make sure the user doesn't enter a negative value.

Declare value as integer
Declare continue as Boolean
Set continue = true
While continue = true
Display "Enter a currency value (positive number): "

Add pseudocode here

For the convert currency module you use case statements
to set the rate.

Convert Currency

Declare rate as real
Select Case of currencyType
case 1:
Set rate = 1.4680
case 2:
Set rate = 9.5085

Add pseudocode here for the rest of the rate, follow example above

You also need to create pseudocode to calculate the US Value, which is rate * international value

Hope this helps
Cheers:)

Is it possible to convert pseudo code to program as it is?

I am sorry to disappoint you but its not always possible! Example:Pseudo code:Step1: Start.Step2: Declare a string variable.Step3: Take input from user.Step4: Store input in String variable and display.Step5: Stop.Java code:package abc;import java.io.*;import java.util.*;class Demo{public static void main(String args[]){String input; // declare string variableScanner sc =new Scanner(System.in);input=sc.next(); //take value from userSystem.out.println(“The input is:”+input); // display on console}}Or you can skip the code in italics and write:System.out.println(“The input is:”+ sc.next()); //take and display input from user.Hope you enjoyed it!! Good luck!!! :-)

How do I convert an algorithm to Java code?

I assume the question is regarding manual transition of algorithm, computation steps written in plain English into Java program.There are few basic points to keep in mind:Read and understand the given problem statement.e.g to find the sum of sequence of 1 through N natural numbers for given list containing different N values.Think or write down the sequence or pseudo code as you would solve that problem manually.initializing the number with 1 adding the successive increment with itself until N. Repeating the above for all the given N values.Before jumping to translate each steps into LoC think of optimizing the solution.Reduced the whole problem scenario into concentrated problem statement (if not available directly).Obviously you can't keep on looping throughout the code block for each and every large input from a hug list. So learn about execution complexity and pick the constructs accordingly.sine the requirement is merely to read lines, use BufferedReader instead of scanner. Likewise use tokenizer in place of split or StringBuilder instead of string (which are immutable causing duplication) as per the requirement and feasibility.We know the pre-computed generalized formula for summation so instead of looping use the formula n(n+1)/2.Now you have the minimal line of codes.While typing in code editors , you have the auto options but still if you're unable to translate any step into the respective line of code refer books or online tutorials.Here's another sample problem statement. “To find if the given list can be arranged as per the given condition”.Condition: number in the list starts with the digit the previous number ends with. e.g of a positive test case (arranged) of length 6 : 12,23,34,45,56,67manually you tend to scan through the numbers and check if the numbers can be arranged in the desired way. However to feed the same intelligence into the program you don't scan or sort digit by digit but you find a simplistic solution utilising the available library, avoiding loops and sub loops.

TRENDING NEWS