Results 1 to 20 of 20
- 07-07-2010, 11:39 AM #1
Member
- Join Date
- May 2010
- Posts
- 19
- Rep Power
- 0
Masking passwords & booking movies
HELLO HERE I AM AGAIN!
Alright so for the next part of my current assignment is another headache. I'm supposed to do an online movie booking system. And of course, my program design sucks very badly as I'm not too sure on how to create the classes. If there is someone willing enough to push me to the right track, I would appreciate it.
Firstly, there are 3 types of movie members, normal, silver and gold. Then there's a movie class which holds all the movie titles and all that, in the movies there is halls which showcases different movies and such, but let's just leave it that my movies class only makes the movies. And one main cinema class which runs the whole thing.
So my methods would be right now is just .bookMovie(). And there I'm a little confused, how am I supposed to let my users book their movie in their own account? Because the member's class is not extended to movie, it is a different and has no relation. So I could need some help with this.
So then, there's this feature that I would also like to do which is to mask the user's passwords. I did research that I could do: text.setEchoChar("*").
But I'm not so familiar. I could need some help with designing my movie booking program! Thanks!
- 07-08-2010, 07:55 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
What you've tried so far? Can you show your effort here?
First of all design your application properly, by stepping down the final goal. Decide how many classes you want to handle this, what are the information you required to process, how the information passing, possibilities for future improvements, etc..
- 07-14-2010, 07:05 AM #3
Member
- Join Date
- May 2010
- Posts
- 19
- Rep Power
- 0
Alright, I've decided to design my program bit by bit. Currently, I have a problem with the password things. So like, if you enter the wrong password, the problem should let you reenter at a limit of tries, however, right now my code doesn't does the check except keep looping over and over.
Also, how do you make a relationship between two classes that have no relation to each other? Like if a movie goer wants to book a movie, I can't have my movie class extend the member class, so what can I do to let my movie user book a movie which is in another class?Java Code:else if (choice == 4) { System.out.println("Entering Booking System. "); System.out.println("Please enter member login. "); System.out.println("Please enter member ID: "); int search = scan.nextInt(); for (Members checkID: Member) { if (checkID.getID() == search) { System.out.println("Please enter password (Case sensivite): "); scan.nextLine(); String pass = scan.nextLine(); for (Members checkPass : Member) { if (checkPass.getPass().equals(pass)) { System.out.println("Password matched."); break; } else if (!checkPass.getPass().equals(pass)) { System.out.println("Please reenter password: "); pass = scan.nextLine(); } } } } }
- 07-15-2010, 04:33 AM #4
Senior Member
- Join Date
- Feb 2010
- Location
- Waterford, Ireland
- Posts
- 748
- Rep Power
- 4
have you heard of a while loop?
- 07-15-2010, 05:33 AM #5
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Yeah, that's good to look around.
- 07-15-2010, 07:01 AM #6
Member
- Join Date
- May 2010
- Posts
- 19
- Rep Power
- 0
My while loop is at the very top that compacts all of my other choices together, but iI suppose using another one might work. Anyways, prior to my question at the bottom of my codes.
I'm asking how might I let my user book a movie from the movie class? Right now I can't think of how I'm going to do that, but I do get the idea that it might be using the ArrayList<>. However, I would like some expert opinion on getting my user to book a movie. Both classes are not extended and are standalone with one main. Any suggestions?
- 07-15-2010, 05:50 PM #7
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 07-16-2010, 04:55 AM #8
Member
- Join Date
- May 2010
- Posts
- 19
- Rep Power
- 0
Well, I've decided to make another class called Tickets.
Movies fields:
title
ID
time
that's all. So I guess I will be using an Array to compare with the other arrays, I'll see how it goes. Thanks for trying to help.
- 07-16-2010, 05:55 AM #9
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Do you have a design about this, can you bit explain. Actually changing the application based on your difficulties found on the way is not good, upto some extend is fine. You must have a proper design at the begging, even not it completely decide up to some extend at least.
- 07-16-2010, 08:39 AM #10
Member
- Join Date
- May 2010
- Posts
- 19
- Rep Power
- 0
Alright this is my design right now.
Member class
Movie class
Ticket class
Member fields:
name, id, password
methods:
getname(), getID()
Movie fields:
title, id, time
methods:
getTitle(), getmovieID(), getTime()
Tickets fields:
tictotal, id, name
methods:
getTicketTotal(), getbookedID(), getbookedName()
In my main is where all the workings are happening, like what happens if you choose this choice and the like. I've got some logic error in my codes one that's logging in the member's password and the like. Can't really figure it out, since my braces seem right. :(
- 07-17-2010, 01:36 AM #11
Senior Member
- Join Date
- Feb 2010
- Location
- Waterford, Ireland
- Posts
- 748
- Rep Power
- 4
getTime() as a method of the class Movie is breaking Movies abstraction, it should not be there, when making methods always ask yourself the question does a movie "have a..."
For e.g. does a movie have a Title, yes. Does a movie have a time? no.
If you want to let a user book a movie, why not make a Booking class with say a method called:
Make a Time class to handle timesJava Code:bookAMovie(Movie theMovie, Member theMember, Ticket memberTicket, Time timeOfBooking){ // insert the necessary here }
- 07-17-2010, 04:59 PM #12
Member
- Join Date
- May 2010
- Posts
- 19
- Rep Power
- 0
Oh?! Constructors can call other exterior classes and use their variables? I didn't know that. :D
But then I actually don't understand the...
What's it doing?Java Code:bookAMovie([B]Movie theMovie, Member theMember, Ticket memberTicket, Time timeOfBooking[/B])
Last edited by suneko; 07-17-2010 at 05:11 PM.
- 07-18-2010, 02:22 AM #13
Senior Member
- Join Date
- Feb 2010
- Location
- Waterford, Ireland
- Posts
- 748
- Rep Power
- 4
Constuctors can be passed exterior class variables e.g.
Do more reading on the fundamentals of classesJava Code:public myConstructor(Movie theMovie){ theMovie=new Movie(); }
- 07-18-2010, 03:29 AM #14
Why do that? The new object's reference goes out of scope on exit from the method.public myConstructor(Movie theMovie){
theMovie=new Movie();
}
Remember pass by value.
- 07-18-2010, 09:35 AM #15
Member
- Join Date
- May 2010
- Posts
- 19
- Rep Power
- 0
Actually, I tried doing that, but it gave me no new sense of breakthrough, so I won't be using it in my codes or perhaps that I will, I will have to talk to my facilitator tomorrow in the morning to see what went wrong and how I can improve my codes.
I tried using the contructor and calling exterior classes but it gave me more trouble than I could figure it out though. Thanks for suggesting. Are there other ways of which can help my user book movies?
- 07-21-2010, 03:40 PM #16
Member
- Join Date
- May 2010
- Posts
- 19
- Rep Power
- 0
Okay, I've managed to do as much as I can, although I'm not pretty sure how do you print out values within a value of a values in a vector?
I have this theatre vector which holds, showPrices vector which holds all the variables of my movie prices. Can I have some help?
- 07-21-2010, 03:43 PM #17
Can you explain what that means?how do you print out values within a value of a values in a vector?
Show an example of what the print out should look like? And explain where the info to print comes from.
Does some of the info to print come from the theatre vector and some come from the showPrices vector?
- 07-21-2010, 11:18 PM #18
Senior Member
- Join Date
- Feb 2010
- Location
- Waterford, Ireland
- Posts
- 748
- Rep Power
- 4
- 07-21-2010, 11:19 PM #19
Senior Member
- Join Date
- Feb 2010
- Location
- Waterford, Ireland
- Posts
- 748
- Rep Power
- 4
Can you post what you have now? would help out alot.
- 07-22-2010, 04:46 AM #20
Member
- Join Date
- May 2010
- Posts
- 19
- Rep Power
- 0
Similar Threads
-
Masking a credit card value
By Samurai Coder in forum New To JavaReplies: 2Last Post: 12-02-2009, 09:05 PM -
Masking password for logging
By firewalll in forum New To JavaReplies: 1Last Post: 09-29-2009, 08:04 AM -
Watch TV on PC - 12,000 TV Channels and Movies, save money Get $10 rebate.
By arturmoniswork in forum Reviews / AdvertisingReplies: 0Last Post: 12-30-2008, 05:56 AM -
Taking passwords on the console
By eva in forum Advanced JavaReplies: 2Last Post: 12-19-2007, 09:28 AM -
Pls help with a project. About doing passwords. Thanks
By saytri in forum New To JavaReplies: 0Last Post: 12-15-2007, 08:29 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks