So I just learnt how to write pseudo codes and so lets say this is my code
import java.util.Date;
import java.util.Calendar;
import java.text.SimpleDateFormat;
class Watever{
public static final String foo="12345151";
public static String today;
public static String expiry;
public static void date(){
SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("dd/MM/yy");
Calendar calen = Calendar.getInstance();
Date todayDate = calen.getTime();
today = DATE_FORMAT.format(todayDate);
calen.add(Calendar.MONTH, 4);
Date expirationDate = calen.getTime();
expiry = DATE_FORMAT.format(expirationDate);
}
public static void main(String[] args){
date();
System.out.println(today);
int bar = Integer.parseInt(foo);
System.out.println(bar);
}
}
Would this be an acceptable pseudo code(given that we're gonna write the code in java)
PROGRAM Watever:
Declare public final String foo="12345151";
Declare public String today;
method date():
GET Today's date;
today= Today's date;
expiry= today+ 4 MONTHS;
Format today AND expiry to "dd/MM/yy"
method main(String[] args):
CALL date();
PRINT today;
Convert String foo to int bar;
PRINT bar;
END
and lets say if we use scanner object to for system.in, do we have to say that we used it or do we just use
PROMPT user "Enter number: ";
GET num;
also how do we write the pseudocode for a printf(formatted string)
Pseudocode is a more informal expression. It is language independent. You do not have to declare variables in pseudocode. You just have to get the message across in a good manner.
For printf you can use print "message"
Hi, you can check out the following links they will definitely help.