New Posts  All Forums:Forum Nav:

Need Pseudo Code HELP

post #1 of 12
Thread Starter 
So this week i finish my "intro" to program design. We basically used python and raptor to understand the concept of flowcharting and basic pseudo code. Now my instructor has given us the option to create a program. I dont have a problem with that, but he says he usually can kill a complete program with one key stroke. Im stumped at what it could be or what else i could do to prevent him from crashing my program. Any ideas?
Edited by graphicsman - 2/28/11 at 7:07pm
OverKill
(18 items)
 
  
CPUMotherboardGraphicsGraphics
AMD Phenom II X6 1055T Gigabyte 890FXA ATI FirePro V3800 ATI FirePro V3800 
RAMHard DriveHard DriveOptical Drive
16gb GSkill 10666 Seagate Western Digital  LG Blue Ray 
CoolingOSMonitorMonitor
stock air 7 Pro 64 bit (2)22" Acer x223w (2)23" Acer G235H 
KeyboardPowerCaseMouse
Microsoft Wireless Antec 900watt Antec 300 Wacom Tablet 
Audio
Logitech Speakers and sub 
  hide details  
Reply
OverKill
(18 items)
 
  
CPUMotherboardGraphicsGraphics
AMD Phenom II X6 1055T Gigabyte 890FXA ATI FirePro V3800 ATI FirePro V3800 
RAMHard DriveHard DriveOptical Drive
16gb GSkill 10666 Seagate Western Digital  LG Blue Ray 
CoolingOSMonitorMonitor
stock air 7 Pro 64 bit (2)22" Acer x223w (2)23" Acer G235H 
KeyboardPowerCaseMouse
Microsoft Wireless Antec 900watt Antec 300 Wacom Tablet 
Audio
Logitech Speakers and sub 
  hide details  
Reply
post #2 of 12
Just make a launcher for your app that runs nohup first.
Gene-Z Dedi
(7 items)
 
Captain America
(6 items)
 
 
CPUMotherboardRAMHard Drive
i7 2600k @ 5.2 Ghz Asus Maximus IV Gene-Z Gskill 2133 4GB Caviar Black 
CoolingOSPower
Corsair H100 Arch x64 OCZ 650 Watt 
CPUCPUMotherboardGraphics
Intel Xeon E5-2650 Intel Xeon E5-2650 ASUS Z9PE-D8 WS XFX 6870 
RAMOS
32 GB Samsung Arch Nix 
  hide details  
Reply
Gene-Z Dedi
(7 items)
 
Captain America
(6 items)
 
 
CPUMotherboardRAMHard Drive
i7 2600k @ 5.2 Ghz Asus Maximus IV Gene-Z Gskill 2133 4GB Caviar Black 
CoolingOSPower
Corsair H100 Arch x64 OCZ 650 Watt 
CPUCPUMotherboardGraphics
Intel Xeon E5-2650 Intel Xeon E5-2650 ASUS Z9PE-D8 WS XFX 6870 
RAMOS
32 GB Samsung Arch Nix 
  hide details  
Reply
post #3 of 12
Thread Starter 
does anyone know of a way to create a loop that will only allow real intergers and prompt an error if any other value is entered?
OverKill
(18 items)
 
  
CPUMotherboardGraphicsGraphics
AMD Phenom II X6 1055T Gigabyte 890FXA ATI FirePro V3800 ATI FirePro V3800 
RAMHard DriveHard DriveOptical Drive
16gb GSkill 10666 Seagate Western Digital  LG Blue Ray 
CoolingOSMonitorMonitor
stock air 7 Pro 64 bit (2)22" Acer x223w (2)23" Acer G235H 
KeyboardPowerCaseMouse
Microsoft Wireless Antec 900watt Antec 300 Wacom Tablet 
Audio
Logitech Speakers and sub 
  hide details  
Reply
OverKill
(18 items)
 
  
CPUMotherboardGraphicsGraphics
AMD Phenom II X6 1055T Gigabyte 890FXA ATI FirePro V3800 ATI FirePro V3800 
RAMHard DriveHard DriveOptical Drive
16gb GSkill 10666 Seagate Western Digital  LG Blue Ray 
CoolingOSMonitorMonitor
stock air 7 Pro 64 bit (2)22" Acer x223w (2)23" Acer G235H 
KeyboardPowerCaseMouse
Microsoft Wireless Antec 900watt Antec 300 Wacom Tablet 
Audio
Logitech Speakers and sub 
  hide details  
Reply
post #4 of 12
He's probably interrupting programs with Ctrl-C. That's easy to work around.

Code:
def main()
    # my code here

if __name__ == "__main__":
    try:
        main()
    except KeyboardInterrupt:
        pass
Underground
(14 items)
 
  
CPUMotherboardGraphicsRAM
Core i7 920 C0 ASUS P6T6 WS Revolution GTX 460 TR3X6G1600C8D 
Hard DriveOptical DriveCoolingOS
WD1001FALS SAMSUNG SH-S223F 22X DVD MULTI Corsair H50 Fedora 16 KDE x86_64 
MonitorKeyboardPowerCase
HP w19b Microsoft Comfort Curve Corsair CX600 Thermaltake Armor VA8003BWS 
MouseMouse Pad
Razer DeathAdder Black 
  hide details  
Reply
Underground
(14 items)
 
  
CPUMotherboardGraphicsRAM
Core i7 920 C0 ASUS P6T6 WS Revolution GTX 460 TR3X6G1600C8D 
Hard DriveOptical DriveCoolingOS
WD1001FALS SAMSUNG SH-S223F 22X DVD MULTI Corsair H50 Fedora 16 KDE x86_64 
MonitorKeyboardPowerCase
HP w19b Microsoft Comfort Curve Corsair CX600 Thermaltake Armor VA8003BWS 
MouseMouse Pad
Razer DeathAdder Black 
  hide details  
Reply
post #5 of 12
Quote:
Originally Posted by error10 View Post
He's probably interrupting programs with Ctrl-C. That's easy to work around.

Code:
def main()
    # my code here

if __name__ == "__main__":
    try:
        main()
    except KeyboardInterrupt:
        pass
I thought about ctrl commands too, but he said "one keystroke." I think it would be hilarious if his professor walks over to the computer and presses the power button and is like "told you."
Intellect v2
(9 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i7-6700K Processor ASUS ROG MAXIMUS VIII HERO LGA1151 DDR4 M.2 SAT... EVGA GTX 1080 SC ACX 3.0 Crucial Ballistix Sport 32GB DDR4 2400 MT/s (PC... 
CoolingKeyboardPowerCase
Noctua NH-D15 Das Keyboard 4 Professional (Brown) Corsair AX860 Fractal Design Define R5 
Mouse
MIONIX NAOS 7000 
  hide details  
Reply
Intellect v2
(9 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i7-6700K Processor ASUS ROG MAXIMUS VIII HERO LGA1151 DDR4 M.2 SAT... EVGA GTX 1080 SC ACX 3.0 Crucial Ballistix Sport 32GB DDR4 2400 MT/s (PC... 
CoolingKeyboardPowerCase
Noctua NH-D15 Das Keyboard 4 Professional (Brown) Corsair AX860 Fractal Design Define R5 
Mouse
MIONIX NAOS 7000 
  hide details  
Reply
post #6 of 12
Bahaha, i can just see it now... student spends hours trying to figure out how to prevent teacher from interrupting program. Teacher comes over reaches around and flicks the power switch on the back of the computer, "See, one key stroke".

Lulz

Quote:
Originally Posted by Plex View Post
I thought about ctrl commands too, but he said "one keystroke." I think it would be hilarious if his professor walks over to the computer and presses the power button and is like "told you."
My System
(13 items)
 
  
CPUMotherboardGraphicsRAM
I5 760 GA-H55N GTX 470 PNY Optima 8GB 
Hard DriveMonitorPowerCase
Spinpoint F4 LG227WTG sg07 PSU Sugo sg07 
Mouse
CM Sentinel 
  hide details  
Reply
My System
(13 items)
 
  
CPUMotherboardGraphicsRAM
I5 760 GA-H55N GTX 470 PNY Optima 8GB 
Hard DriveMonitorPowerCase
Spinpoint F4 LG227WTG sg07 PSU Sugo sg07 
Mouse
CM Sentinel 
  hide details  
Reply
post #7 of 12
Quote:
Originally Posted by mykah89 View Post
Bahaha, i can just see it now... student spends hours trying to figure out how to prevent teacher from interrupting program. Teacher comes over reaches around and flicks the power switch on the back of the computer, "See, one key stroke".

Lulz
Haha, yeah. I'm sure he could come up with a "lesson" in all of that somehow.

"You know how you were pointlessly going over all of your code, line-by-line, checking for any potential issues or bugs? That's what you need to be doing all of the time."

Would be a dick move though, .

You know the old programming saying: "First make it work, then make it right, then make it fast."
Intellect v2
(9 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i7-6700K Processor ASUS ROG MAXIMUS VIII HERO LGA1151 DDR4 M.2 SAT... EVGA GTX 1080 SC ACX 3.0 Crucial Ballistix Sport 32GB DDR4 2400 MT/s (PC... 
CoolingKeyboardPowerCase
Noctua NH-D15 Das Keyboard 4 Professional (Brown) Corsair AX860 Fractal Design Define R5 
Mouse
MIONIX NAOS 7000 
  hide details  
Reply
Intellect v2
(9 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i7-6700K Processor ASUS ROG MAXIMUS VIII HERO LGA1151 DDR4 M.2 SAT... EVGA GTX 1080 SC ACX 3.0 Crucial Ballistix Sport 32GB DDR4 2400 MT/s (PC... 
CoolingKeyboardPowerCase
Noctua NH-D15 Das Keyboard 4 Professional (Brown) Corsair AX860 Fractal Design Define R5 
Mouse
MIONIX NAOS 7000 
  hide details  
Reply
post #8 of 12
Thread Starter 
nah i doubt he would do that, or hope, lol
OverKill
(18 items)
 
  
CPUMotherboardGraphicsGraphics
AMD Phenom II X6 1055T Gigabyte 890FXA ATI FirePro V3800 ATI FirePro V3800 
RAMHard DriveHard DriveOptical Drive
16gb GSkill 10666 Seagate Western Digital  LG Blue Ray 
CoolingOSMonitorMonitor
stock air 7 Pro 64 bit (2)22" Acer x223w (2)23" Acer G235H 
KeyboardPowerCaseMouse
Microsoft Wireless Antec 900watt Antec 300 Wacom Tablet 
Audio
Logitech Speakers and sub 
  hide details  
Reply
OverKill
(18 items)
 
  
CPUMotherboardGraphicsGraphics
AMD Phenom II X6 1055T Gigabyte 890FXA ATI FirePro V3800 ATI FirePro V3800 
RAMHard DriveHard DriveOptical Drive
16gb GSkill 10666 Seagate Western Digital  LG Blue Ray 
CoolingOSMonitorMonitor
stock air 7 Pro 64 bit (2)22" Acer x223w (2)23" Acer G235H 
KeyboardPowerCaseMouse
Microsoft Wireless Antec 900watt Antec 300 Wacom Tablet 
Audio
Logitech Speakers and sub 
  hide details  
Reply
post #9 of 12
Thread Starter 
I need help please in writing my final project class. This is an intro program design class and im stuck in how i can get my Pseudo code to run a balance. Any ideas?? Here is my code i have so far:

Code:

Module main()
//Declare local variables
Declare String choice = “0†//choice
Declare Real totalBudget = 4000 //amount made monthly
Declare Real totalExpense = 0 //amount spent monthly
Declare Real expense
Declare Int monthFrequency
Declare Real tempExpense
Declare Real newRevenue

//while loop
While choice != “5â€
//display menu
Call menu(choice)
//check menu selection
If choice == “1†Then
Call addExpense(totalBudget, totalExpense, expense, monthFrequency, tempExpense)
Else If choice == “2†Then
Call removeExpense(totalBudget, totalExpense, expense, monthFrequency, tempExpense)
Else If choice == “3†Then
Call addRevenue(totalBudget, newRevenue, totalExpense)
Else If choice == “4†Then
Call removeRevenue()
Else If choice == “5†Then
Display “Goodbye!â€
Else
Display “Invalid input – please try again.â€
End If
End While
End Module

//displays menu
Module menu(String Ref choice)
Display “Menu Selections:â€
Display “1 – Add an Expenseâ€
Display “2 – Remove an Expenseâ€
Display “3 – Add Revenueâ€
Display “4 – Remove Revenueâ€
Display “5 – Exitâ€
Display “Enter your selection:â€
Input choice
End Module






//adds monthly expense
Module addExpense(Real totalBudget, Real Ref totalExpense, Real expense, Int monthFrequency, Real newExpense)
Display “Enter expense amount added:â€
Input expense
Display “Enter frequency of expense per month:â€
Input monthFrequency
tempExpense = (expense * monthFrequency) + totalExpense
If tempExpense > totalBudget Then
Display “The expense addition is rejected.â€
Display “The expense exceeds the amount allowed by your budget.â€
Else If tempExpense <= totalBudget Then
totalExpense = tempExpense
Display “The expense was accepted.â€
Display “Your remaining monthly budget is “, totalBudget - totalExpense
Else
Display “Invalid input – please try again.â€
End If
addExpenseBalance = totalbudget - totalExpense
Display  “Your balance is: “ addExpenseBalance
End Module







//removes monthly expense
Module removeExpense(Real totalBudget, Real Ref totalExpense, Real expense, Int monthFrequency, Real tempExpense)
Display “Enter expense amount removed:â€
Input expense
Display “Enter frequency of expense per month:â€
Input monthFrequency
tempExpense = totalExpense - (expense * monthFrequency)
If tempExpense > totalExpense Then
Display “The expense removal is rejected.†
Display “The expense removed is greater than the total expenses.â€
Else If tempExpense <= totalExpense Then
totalExpense = tempExpense
Display “The expense removal is accepted.â€
Display “Your remaining budget is “, totalBudget – totalExpense
Else
Display “Invalid input – please try again.â€
End If
End Module

//adds to budget
Module addRevenue(Real Ref totalBudget, Real newRevenue, Real totalExpense)
Display “Enter amount of monthly income to be added:â€
Input newRevenue
If newRevenue >= 0 Then
totalBudget = totalBudget + newRevenue
Display “The revenue addition was accepted.â€
Display “Your remaining budget is “, totalBudget – totalExpense
Else
Display “Invalid input – please try again.â€
End Module

//removes from budget
Module removeRevenue(Real Ref totalBudget, Real newRevenue, Real totalExpense)
Display “Enter amount of monthly income to be removed:â€
Input newRevenue
If newRevenue > totalBudget - totalExpenses Then
Display “The revenue removal was rejected.â€
Display “The revenue removed is greater than the remaining budget.â€
Else If newRevenue <= totalBudget – totalExpenses Then
totalBudget = totalBudget – newRevenue
Display “The revenue removal was accepted.â€
Display “Your remaining budget is “, totalBudget - totalExpenses
Else
Display “Invalid input – please try again.â€
End If
End Module
Any other ideas on how to make it bullet proof would be great.
OverKill
(18 items)
 
  
CPUMotherboardGraphicsGraphics
AMD Phenom II X6 1055T Gigabyte 890FXA ATI FirePro V3800 ATI FirePro V3800 
RAMHard DriveHard DriveOptical Drive
16gb GSkill 10666 Seagate Western Digital  LG Blue Ray 
CoolingOSMonitorMonitor
stock air 7 Pro 64 bit (2)22" Acer x223w (2)23" Acer G235H 
KeyboardPowerCaseMouse
Microsoft Wireless Antec 900watt Antec 300 Wacom Tablet 
Audio
Logitech Speakers and sub 
  hide details  
Reply
OverKill
(18 items)
 
  
CPUMotherboardGraphicsGraphics
AMD Phenom II X6 1055T Gigabyte 890FXA ATI FirePro V3800 ATI FirePro V3800 
RAMHard DriveHard DriveOptical Drive
16gb GSkill 10666 Seagate Western Digital  LG Blue Ray 
CoolingOSMonitorMonitor
stock air 7 Pro 64 bit (2)22" Acer x223w (2)23" Acer G235H 
KeyboardPowerCaseMouse
Microsoft Wireless Antec 900watt Antec 300 Wacom Tablet 
Audio
Logitech Speakers and sub 
  hide details  
Reply
post #10 of 12
Thread Starter 
bump
OverKill
(18 items)
 
  
CPUMotherboardGraphicsGraphics
AMD Phenom II X6 1055T Gigabyte 890FXA ATI FirePro V3800 ATI FirePro V3800 
RAMHard DriveHard DriveOptical Drive
16gb GSkill 10666 Seagate Western Digital  LG Blue Ray 
CoolingOSMonitorMonitor
stock air 7 Pro 64 bit (2)22" Acer x223w (2)23" Acer G235H 
KeyboardPowerCaseMouse
Microsoft Wireless Antec 900watt Antec 300 Wacom Tablet 
Audio
Logitech Speakers and sub 
  hide details  
Reply
OverKill
(18 items)
 
  
CPUMotherboardGraphicsGraphics
AMD Phenom II X6 1055T Gigabyte 890FXA ATI FirePro V3800 ATI FirePro V3800 
RAMHard DriveHard DriveOptical Drive
16gb GSkill 10666 Seagate Western Digital  LG Blue Ray 
CoolingOSMonitorMonitor
stock air 7 Pro 64 bit (2)22" Acer x223w (2)23" Acer G235H 
KeyboardPowerCaseMouse
Microsoft Wireless Antec 900watt Antec 300 Wacom Tablet 
Audio
Logitech Speakers and sub 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Application Programming