DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2005
    Posts
    44

    Boolean vlaue for a video store program - please help!!

    Hi,

    Any idea how I can add a boolean method that will simply say whether a video is available or not. Such as, 'if' the video is available return true, 'else' return false.

    I have to admit I'm pretty useless with boolean statements and would appreciate any advice.

    The program is a simple Video store management program. My current code is as follows,

    Code:
    package videos;
     
    public class Video {
        
        private int days, referenceNumber;
        private static double dailyPrice;
        private double totalPrice;
        private Title videoTitle;
        
        public Video(int refNum, Title t, int d, double dp) {
            referenceNumber = refNum; videoTitle = t; days = d; dailyPrice = dp;
        }
        
        public Video(int title, String film, String lead1, String lead2, String dir){
            videoTitle = new Title(title, film, lead1, lead2, dir);
        }
        
        public Title getTitle() {
            return videoTitle;
        }
        
        public int getReferenceNumber() {
            return referenceNumber;
        }
        
        public void setReferenceNumber(int refNum) {
            referenceNumber = refNum;
        }
        
        public int getDays() {
            return days;
        }
        
        public void setDays(int d) {
            days = d;
        }
        
        public double getDailyPrice() {
            return dailyPrice;
        }
        
        public void setDailyPrice(double dp) {
            dailyPrice = dp;
        }
        
        public double getTotalPrice() {
            return totalPrice;
        }
        
        public void ApplyTotalPrice() {
            totalPrice = days*dailyPrice;
        }
        
        public String toString() {
            return referenceNumber + "" + videoTitle + "" + totalPrice;
        }
    }
    Also, do you think the above method for calculating TotalPrice will work in this class?

    Any help appreciated!!

  2. #2
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    have a data member to your class which is a boolean - available

    this member's value is returned by the method isAvailable().

    Any action relating to the check out, check in, etc. of the video would include a query to isAvailable().

    if (isAvailable() )
    {
    this.checkOut()
    }
    else
    {
    System.out.println( "Sorry, this title is not available. Choose another." );
    }

    or something like that ....

Similar Threads

  1. capturing and dumping video streaming via http
    By Zingaro2002 in forum .NET
    Replies: 0
    Last Post: 10-07-2005, 12:03 PM
  2. How long before the next version??
    By _CAG in forum .NET
    Replies: 146
    Last Post: 08-12-2002, 10:40 PM
  3. Re: App Object (fixes)
    By Rob Teixeira in forum .NET
    Replies: 129
    Last Post: 06-06-2002, 05:23 AM
  4. Object Array ? Do you Worth it
    By ashish in forum Java
    Replies: 1
    Last Post: 05-23-2002, 07:50 AM
  5. Please help with running executable vb program.
    By Gordon Reichhardt in forum VB Classic
    Replies: 2
    Last Post: 01-08-2002, 10:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links