d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Completely Lost > Pseudocode/flowchart
Add Reply New Topic New Poll
Retired Moderator
Posts: 15,420
Joined: May 28 2006
Gold: 38.00
Trader: Trusted
Jul 9 2012 09:31pm
I know for a lot of you that code stuff, me not knowing this is laughable, but I really need help on this. I've stayed after for help but my teacher can't really explain it.

This is my question:
Exercise: A gallery owner would like you to design a program that will produce limited edition certificates.

Create a class diagram and pseudocode for a certificate class (artist, title, number of certificates, and a method to produce the specified number of certificates. ).
For the class client (the application program), create an IPO chart, flowchart, and pseudocode. Allow the user to repeatedly enter an artists's name, title of the piece, and the number of certicates to produce.
On each certificate include the title of the piece, the artist's name, the current certificate number, and the total number of certificates.

We aren't working with code right now. Here's an example solution:
class CheckingAccount
// Declarations
private num accountNum
private string name
private num balance

public void setAccountNum(num number)
accountNum = number
return

public void setName(string name)
this.name = name
return

public void setBalance(num bal)
balance = bal
return

public void displayValues()
output “Account number: ”, accountNum
output “Name: ”, name
output “Balance: ”, balance
return
endClass


If you can help me out with this problem, and hopefully the understanding of it, I'll pay in fg.

Assignment is due tomorrow. :rolleyes:
Member
Posts: 299
Joined: Apr 11 2010
Gold: 2,491.00
Jul 10 2012 06:45am
This will run once and print out the certificates. If you need to be able to do multiple print runs in a row, wrap the contents of the run method in a loop of some sort and let the user abort by entering a special command.

class client {

public void run {
string artist = promptForInput("Please enter the artist's name:")
string title = promptForInput("Please enter the title of the piece:")
num total = promptForInput("Please enter the total number of certificates:")

for each i in 1-total {
certificate cert = new certificate(artist, title, total, i)
cert.print
}
}
}

class certificate {

private string artist
private string title
private num total
private num number

public certificate(string artist, string title, num total, num number {
this.artist = artist
this.title = title
this.total = total
this.number = number
}

public void print() {
print("Certificate #" + number + " of " + total + ":")
print(title)
print("By " + artist)
print()
}
}
Retired Moderator
Posts: 15,420
Joined: May 28 2006
Gold: 38.00
Trader: Trusted
Jul 10 2012 07:17am
Thanks for responding man, I didn't think I would get anything.

It does have to loop somehow. And it's not supposed to print, I think it's just supposed to output? No idea. lol
Member
Posts: 299
Joined: Apr 11 2010
Gold: 2,491.00
Jul 10 2012 08:40am
assuming you have something that will take y/n or similar input and give you true/false, you could have

public void run {
boolean runAgain = true

while (runAgain) {
[above prompt and for each code]
runAgain = promptForInput("Do you want to print another set of certificates?"
}
}
Member
Posts: 299
Joined: Apr 11 2010
Gold: 2,491.00
Jul 10 2012 08:42am
Oh, when I said "print" above I meant output to the screen, not like print to paper. In your pseudocode, my

print("Certificate #" + number + " of " + total + ":")
print(title)
print("By " + artist)
print()

would be

output "Certificate #", number, " of ", total, ":"
output title
output "By ", artist
output ""
Member
Posts: 299
Joined: Apr 11 2010
Gold: 2,491.00
Jul 10 2012 08:46am
I had never heard of an IPO chart before, but it looks like your client's IPO chart would be

Input: none
Process: prompt for certificate parameters, output certificates, possibly repeat
Output: certificates

I guess "input" only counts for data that is fed into the program and not data it acquires while it runs.

The flowchart would be something like

start -> prompt for params -> print certificate -> prompt for repeat -> exit

with prompt for repeat having a second branch that sends you back to prompt for params.
Retired Moderator
Posts: 15,420
Joined: May 28 2006
Gold: 38.00
Trader: Trusted
Jul 23 2012 06:32pm
I'm back at it this week. Were in arrays now.
This is my problem:

Design a program that will accept the names, number of wins, and number of losses for 10 basketball teams.

Use initializer lists to load the data.
Allow the user to choose from the following options:
1) to list all teams and data, including the percentage of wins.
2) to list the team(s) with the best record.
3) to search for a team by name and list the team's data.
Provide flowchart OR pseudocode.

If anyone can help me understand this, let me know.
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Jul 23 2012 08:21pm
what part do you not understand? this sounds straight forward. imagine if you wanted to use that program and think how the screen flow should work

This post was edited by carteblanche on Jul 23 2012 08:22pm
Retired Moderator
Posts: 15,420
Joined: May 28 2006
Gold: 38.00
Trader: Trusted
Jul 23 2012 08:37pm
Quote (carteblanche @ Jul 23 2012 10:21pm)
what part do you not understand? this sounds straight forward. imagine if you wanted to use that program and think how the screen flow should work


The logic part I get.
I fail at putting my ideas into pseudo code.

I don't understand classes and how they're used by clients, or how to use arrays.

This statements
Get statements
ect
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Jul 23 2012 08:50pm
start in pieces. write pseudocode for each of the pieces

an array is just a numbered list. read your book for more details, but that should be enough for just pseudocode

first part of #3:

Code

findTeam(string name){
  foreach team in teams{
      if team.name == name then
         return team
  }
}
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll