d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Need Help With Pseudocode > Any One?
Add Reply New Topic New Poll
Member
Posts: 4,729
Joined: Apr 4 2008
Gold: 596.00
Dec 7 2014 09:21pm
design pseudo code for a program that reads a file, sorts it in alphabetical order by last name, first name, deletes duplicate records , prints the list of names in last name , first name order and prints the total number of records at the end of the report.

declerations
CustFile = FileName
num custNum
string LatName
string FirstName
string Address
string City
string State
num Balance


Can any one do this for me or help if you can do it form me ill pay a good amount of fg thank you.
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Dec 7 2014 09:37pm
what is your pseudo code already?
Member
Posts: 4,729
Joined: Apr 4 2008
Gold: 596.00
Dec 7 2014 10:25pm
Quote (carteblanche @ Dec 7 2014 07:37pm)
what is your pseudo code already?


I havent started this one yet i still have 2. Others working on them right now
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Dec 7 2014 10:29pm
Quote (TonyAkACheif @ Dec 7 2014 11:25pm)
I havent started this one yet i still have 2. Others working on them right now


how do you know you need help if you havent started? post back here after you've given it a shot.
Member
Posts: 62,215
Joined: Jun 3 2007
Gold: 9,039.20
Dec 8 2014 12:46am
names.txt
Code

Tony Chief
Robbert Chaplen
Sussy Odonald
Henry Crocker
Lucy obrian
Firstname Lastname


code:
Code

names = []
File.readlines("names.txt").each do |line|
line = line.split(" ")
hash = { :firstName => line[0], :lastName => line[1] }
names.push(hash) if !hash.include?(hash)
end
names.sort_by! { |key| key[:lastName] }
names.each { |hash| puts "First name: #{hash[:firstName]}, Last name: #{hash[:lastName]}" }


output unsorted:
Code

Process started >>>
First name: Tony, Last name: Chief
First name: Robbert, Last name: Chaplen
First name: Sussy, Last name: Odonald
First name: Henry, Last name: Crocker
First name: Lucy, Last name: obrian
First name: Firstname, Last name: Lastname
<<< Process finished. (Exit code 0)


output sorted:
Code

Process started >>>
First name: Robbert, Last name: Chaplen
First name: Tony, Last name: Chief
First name: Henry, Last name: Crocker
First name: Firstname, Last name: Lastname
First name: Sussy, Last name: Odonald
First name: Lucy, Last name: obrian
<<< Process finished. (Exit code 0)
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll