Sponsored Links


Results 1 to 2 of 2

Thread: CS304 Assignment no 3 Solution 20th January 2016

  1. #1
    Administrator Vuhelper's Avatar
    Join Date
    Apr 2011
    Posts
    9,578

    Thumbs up CS304 Assignment no 3 Solution 20th January 2016

    Sponsored Links1


    Engine(engineCapacity:int, engineType:string)
    i.e. engine capacity 1500, 1300 etc, engineType patrol, deisle, gas etc
    Door(doorWeight: float, doorTransmission:string) , door weight 10.5, 25.2 KG etc, door transmission , automatic, manual
    Wheel(diameter:int, type:string) 192 diameter etc and type is tubeless
    So Think about all attributes for remaining.
    and then below way is of coding step by step for all classes
    1. create a class
    2. Write attributes defined above as private
    3. provide setter and getter for each and every attribute
    Things to remember as best coding practice
    a. Class name should be Capitalize means if it is single word start Capital if it is multiple word Start every word capital but no space for example if you name your class as AutmaticCar then A and C is capital.
    b. all variable in clas should private and camle case which means if it is single word then small alphabet all if it is multi word then first word will be full small and rest all word should start with Capital for example
    accountDeposit , remainingBalance, lastMonthSalary etc
    c. function should be public and name of function rule should same as variable

    Sponsored Links

  2. #2
    Administrator Vuhelper's Avatar
    Join Date
    Apr 2011
    Posts
    9,578
    Problem Statement:
    Keeping in view the above class diagram, you have to write code for the below mentioned classes and show their relationship with each other:
    1. Class Vehicle:
    Attribute:
    vehicleNo: string
    color: string
    Methods/Operations/Getters/Setters:
    getVehicleNo(): string
    getColor(): string
    2. Class Car:
    distance: int
    Methods/Operations/Getters/Setters:
    setDistance(int): void
    calculateFare(int): int
    displayInformation(): void

    Important points:
    Your program should be able to create a Car object having a number, color and distance without creating an explicit object of Vehicle class.
    All Vehicle attributes should be directly accessible to Car and should not be accessible publically.
    Your program should accept value of distance only between 1-500 kilometers; any other value should be treated as invalid value.
    At the end, information about Car (car number, car color, distance covered) and total fare should be displayed whereas calculateFare(int) is a utility function. Fare is 5 rupees/kilometer.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. cs301 assignment no 3 Solution 20 January 2016
    By Vuhelper in forum Assignments & Solutions
    Replies: 0
    Last Post: 01-20-2016, 02:32 PM
  2. CS201 Assignment vo 3 Solution 20th January 2016
    By Vuhelper in forum Assignments & Solutions
    Replies: 2
    Last Post: 01-20-2016, 02:28 PM
  3. CS101 Assignment no 3 Solution 20th January 2016
    By Vuhelper in forum Assignments & Solutions
    Replies: 0
    Last Post: 01-20-2016, 02:25 PM
  4. Replies: 0
    Last Post: 01-20-2016, 02:19 PM
  5. Replies: 1
    Last Post: 01-20-2016, 02:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
-: Vuhelp Disclaimer :-
None of the files shown here are hosted or transmitted by this server. The links are provided solely by this site's users. The administrator's or staff of Vuhelp.net cannot be held responsible for what its users post, or any other actions of its users. You may not use this site to distribute or download any material when you do not have the legal rights to do so. It is your own responsibility to adhere to these terms. If you have any doubts about legality of content or you have any suspicions, feel free to contact us.
Online Education | JhelumSoft