Questions tagged [pseudocode]

Pseudocode is a compact and informal high-level description of a computer programming algorithm. It represents the code and may look similar to the code or code constructs, but it isn't actual code. It is a representation of the code or code construct. Use this tag for questions which are about pseudocode. Do not use this tag for questions which include pseudocode incidentally.

An easy way of understanding pseudocode is by comparing it to the actual programming language.

For example, you would like to write a code that checks if the student's grade is above the permissible threshold, and if it is then you would like to indicate that the student passed.

This is how it is achieved in Python:

if studentsGrade >= 70:
    print("Student passed")
else
    print("Student failed")

Pseudocode to describe the abovementioned code will be as follows:

if a student's grade is greater than or equal to 70
    Print "Student passed"
else
    Print "Student failed"
1942 questions
0
votes
4 answers

I am totally confused this is an online class I have no clue how to do this homework can anyone tutor me

Question is: Write pseudocode for a program that calculates the service charge of a customer owes for writing a bad check. The program accepts a customer's name, the date the check was written (year, month and day), the current date …
teresa
  • 1
0
votes
1 answer

Pseudocode: Implement division without Comparison Operators

I faced a guestion to implement division without using divide and Comparison Operators such as <, > ==, etc. Also, bit wise operation are not allowed. I can use loop, sub, add, ... There is one condition that I think it is important: There is no…
0
votes
4 answers

Convert fractions to words in Java

I have the following question: I would like to convert fractions like 1/2, 3/4 to spoken words in Java like "One half" or "Three quarters". Is there any way(pseudocode) or utility in Java that produces that output receiving basically…
tludmetal
  • 103
  • 1
  • 8
0
votes
4 answers

Using recursion to create a power method

I am very new to programming, and Java is my first real language. At this point in class we are touching on recursion, and have been asked to make a method that fits certain parameters: The method is as such: public void power(int p) where we…
Tori
  • 1
  • 4
0
votes
1 answer

PHP - Rest Api end points as binary tree

My team is developing a R.E.S.T api for our platform. some examples for endpoints we currently have: campaigns/24566/pictures campaigns/24566/users users/23445646 users/campaigns We currently writing the endpoints in an ugly way for checking the…
Asaf Nevo
  • 11,338
  • 23
  • 79
  • 154
0
votes
4 answers

Question about pseudocode for HW

I have the following question, and what I'm most confused on, is how to do the logic for determining if a check is one month late or not. Question is: "Write pseudocode for a program that calculates the service charge of a customer owes for writing…
eqiz
  • 1,521
  • 5
  • 29
  • 51
0
votes
1 answer

Validate same values on change

Hello I have a problem with validating identical values in input boxes. Event called must be "on change" value of input box, but I have a problem with numbers.I want to write for example "17", but before there was value "1" already inputted in…
Jasiu
  • 17
  • 7
0
votes
1 answer

A concise way to access an element of a set in pseudocode

Let networklocs be a set of elements of the form (n, t, l) where n is a node in the network, t is a clock tick and l is the location of n at time t. How can I get (in a concise way in pseudo-code) the element of networklocs where node and time is…
0
votes
2 answers

Mathematical expressions in pseudo code

I have pseudo code am trying to implement in python but I cant seem to remember what p ← 0 would mean in logic or calculus.
philo
  • 121
  • 1
  • 9
0
votes
1 answer

Program Structure to meet Martin's Clean Code Function Criteria

I have been reading Clean Code by Robert C. Martin and have a basic (but fundamental) question about functions and program structure. The book emphasizes that functions should: be brief (like 10 lines, or less) do one, and only one, thing I am a…
Roberto
  • 2,054
  • 4
  • 31
  • 46
0
votes
1 answer

Maximize points in a given rectangle- (int spacing, int deviation)

I need a function that returns an array of points, it has to maximize the number of points in a rectangle. The function has to favour 100mm spacing (in any direction) but it can deviate by x (integer) to create points that would almost fit. We also…
0
votes
1 answer

How to assign -INFINITY amongst others to multiple variables?

I have this line of pseudocode that I am trying to translate in Matlab: (maxSum, maxStartIndex, maxEndIndex) := (-INFINITY, 0, 0) I have translated the second and third variables simply assigning a 0: maxStartIndex=0; maxEndIndex=0; How should I…
FeliceM
  • 4,163
  • 9
  • 48
  • 75
0
votes
1 answer

"do for" and "do if" in java pseudocode

for an assignment I was given java pseudocode that included lines: do for i = 0...j-1 do if i = 0 and j = 1 for k = 0....i-1 do q <- l[k,i] + dist(p[k],p[j]) since the only use for "do" in java that I am aware of in java is do-while loops,…
jokeSlayer94
  • 143
  • 1
  • 9
0
votes
1 answer

Virus Logic - pseudo / PoC

I am trying to get my head around this problem. Hopefully someone can help. Imagine we have a program called Confusion; Program confusion if(Virus-Finder(Confusion) = false) then infect-executable else halt End program confusion Obviously…
Sam
  • 602
  • 9
  • 21
0
votes
1 answer

Formula Calculation using javaScript

I am trying to do the below using HTML, CSS and JavaScript: Category (Coffee Appliance) drop down product (Kurig Coffe Maker) drop down Wattage : 1500kWh (pre polulated using Local Storage) Daily Energy Consumption (1,500 W × 1) ÷ 1,000 = 1.5…