How can i develope source code of following statement?

Hi All!
I would like to make a source code . The statement is follows. Can anyone help?
public Bicycle seeWhosFastest(Bicycle myBike, Bicycle yourBike, Environment env) {
Bicycle fastest;
// code to calculate which bike is faster, given
// each bike's gear and cadence and given
// the environment (terrain and wind)
return fastest;
Regards,
damp

class Bicycle {
int cadence = 0;
int speed = 0;
int gear = 1;
void changeCadence(int newValue) {
cadence = newValue;
void changeGear(int newValue) {
gear = newValue;
void speedUp(int increment) {
speed = speed + increment;
void applyBrakes(int decrement) {
speed = speed - decrement;
void printStates() {
System.out.println("cadence:"+cadence+" speed:"+speed+" gear:"+gear);
class BicycleDemo {
public static void main(String[] args) {
// Create two different Bicycle objects
Bicycle bike1 = new Bicycle();
Bicycle bike2 = new Bicycle();
// Invoke methods on those objects
bike1.changeCadence(50);
bike1.speedUp(10);
bike1.changeGear(2);
bike1.printStates();
bike2.changeCadence(50);
bike2.speedUp(10);
bike2.changeGear(2);
bike2.changeCadence(40);
bike2.speedUp(10);
bike2.changeGear(3);
bike2.printStates();
Hi Alan.L.Brown!
Above are the source codes of Bicycle.java and BicycleDemo.java.The output after run the program are:
cadence:50 speed:10 gear:2
cadence:40 speed:20 gear:3
I need necessary modification to get seeWhofastest Bicycle. Instead of bike1 and bike2, codes to be changed as myBike and yourBike.Could you please help to sort out?
Regards,
damp.

Similar Messages

  • How can I print source code with connecting lines on control structures?

    Anyone know of any programs that will format source code printouts and print connecting lines from the start to the end of control structures (such as: if--"end if", while-"end while" etc.)?

    Indentations and comments do help read source code. However, when you have a large program with many levels of nesting of control structures the readability of the code (even with indentations) becomes very difficult.

  • How can i develop and implement an enhancement iw39?

    how can i develop and implement an enhancement in standrad program . for example in iw39 in selection screen i have to add few moew fields . so any one guideme how to atchive it
    thanks & regards
    deepurd

    Hi Deepu
    1) Go to program RIAUFK20.
    2) Press the spiral button (ENHANCE)
    3) Right click on the enhancement point mentioned below (available at the end of selection details)
    ENHANCEMENT-POINT riaufk20_25 SPOTS es_riaufk20 STATIC .
    4) Go to Enhancement Implementation -> Create
    5) Create a new implementation
    6) Add your coding in the implementation created.
    Please use the same implementation at all the places in the code where you use an enhancement point.
    Hope it helps.
    Refer Source Code Enhancements - Part 5 of the Series on the New Enhancement Framework for more...
    Cheers
      neer

  • Is there any differnce between the Numeric Limit Test source code from TestStand 3.0 to TestStand 3.1? How to get the source code for the Numric Limit Test for both the versions?

    I need to know the differnece between the Numeric Limit Test between the TestStand version 3.0 to 3.1. If there is any differnec in the source code how to find it out? If somebody has the code can you share it?
    Thanks,
    Jeyan

    Hi,
    I don't believe there are any differences between the two versions. But you can check the source code for the Numeric Limit Test in TestStand\Components\NI\StepTypes\CommonSubsteps. But the main part of the step is the Code Module and this bit the users supplies this.
    What has prompted this question?
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • How to get the source code of  "com.sap.caf.eu.gp.example.tiimeoff.wd.creat

    Hi Frendz..
    I want to know how we can build a callable obj which have a two buttons those r Accept n Reject accordiing to the actions on these buttons flow should forward to next screen(approver ) r sent back to the sender(screen with reject).
    I gone thru the Leave process(Time-Off process) which is very suitable for my requirment but in this app there r using predefined CO(com.sap.caf.eu.gp.example.tiimeoff.wd.create).How we see the source code of this predefined CO.
    Thanks in Advance
    Regards
    Rajesh

    Hi,
    check [this|Re: Source of Time-off Request Project].
    Regards,
    Naga

  • How to find the source code of com.sap.caf.eu.gp.example.tiimeoff.wd.create

    Hi Frendz..
    I want to know how we can build a callable obj which have a two buttons those  r Accept n Reject accordiing to the actions on these buttons flow should forward to next screen(approver ) r sent back to the sender(screen with reject).
    I gone thru the Leave process(Time-Off process) which is very suitable for my requirment but in this app there r using predefined CO(com.sap.caf.eu.gp.example.tiimeoff.wd.create).How we see the source code of this predefined CO.
    Thanks in Advance
    Regards
    Rajesh

    not answered

  • How to view the source code for Native Method

    hi
    i am using some native methods in to my code ;
    can anybody tell me how to view the source code for the same ;
    nik

    Buy/acquire a C/C++/assembly code disassembler and run the shared library through it.

  • How to read the source code

    Hi,
    I want to know how to read the source code of web dynpro java from the source folder i.e. without loading the project in NWDS. Please answer me as soon as possible.
    Thanks & Regards,
    Aniruddha

    Hi,
    If you are using DC's then you can find the .Java files in the path
    <project Name>\_comp\gen_wdp\packages\<Pacjage>\<ComponentName>\..
    In the above path you can find the Java files of the controllers.
    Thanks,
    Raju Bonagiri

  • How to get the source code of a PRT application in the portal

    Hi!
    Does anybody know how to get the source code of a PRT application in the portal?
    Thanks in advance,
    Celso

    Celso,
    If its Java-based code have a look at the properties of an iView that belongs to the application in question and copy the value of the Code Link parameter e.g. 'com.sap.pct.hcm.rc_vacancyrequestov.default'.
    Search the Portal installation directory under /j233/cluster/server/ for a .par.bak file of the same name, removing .default from the codelink parameter
    e.g. com.sap.pct.hcm.rc_vacancyrequestov.par.bak
    Copt this locally and import into Netweaver Developer Studio. You will have to decompilte the class files with a decompiler such as DJ Decompiler or Cavaj (search with Google).
    Cheers,
    Steve

  • How to get the source code of an HTML page in Text file Through java?

    How to get the source code of an HTML page in Text file Through java?
    I am coding an application.one module of that application is given below:
    The first part of the application is to connect our application to the existing HTML form.
    This module would make a connection with the HTML page. The HTML page contains the coding for the Form with various elements. The form may be a simple form with one or two fields or a complex one like the form for registering for a new Bank Account or new email account.
    The module will first connect through the HTML page and will fetch the HTML code into a Text File so that the code can be further processed.
    Could any body provide coding hint for that

    You're welcome. How about awarding them duke stars?
    edit: cheers!

  • Where to  find the pcui_gp  components ,How to get the source code of those

    Hi All,
    Can anybody tell the exact location wher the pcui_gp components will be stored if they are  not appearing.
    And another question is how to get the source code of the pcui_gp for customization.
    anybody working on these compoents please help me.
    answers will be rewarded.
    thanks and regards,
    anand

    Hi Arun,
    I am unable to see the pcui_gp components in the DTR ,I require this in order to get the source code of one of its component.
    Can you please tell me the step by step procedure getting those pcui_gp components from J2ee engine to the  dtr or  NWDI.
    If there are any documents on pcui_gp components exclusively please do forward to my mail id [email protected]
    Thansk and Regards,
    Anand.

  • How can I insert a code to switch between channels?

    I’ve got a HP4263A LCR meter which is being used with an ER-18 device to get multiple channel data acquisition, when I go to getting started to trigger the device, but this VI do not have an icon to change the channel how can I insert a code to switch between channels?

    I am just trying to use the drivers developed by NI for this device, but I don't know how to work on them to obtain data from three points, or three channels which I am using from an ER-16 device. So all what I have is the driver VI for the HP4263A.the only VI I can use is getting started, because whe I try to run any other one, this message appears:
    Error -1073807346 occurred at VISA Write in HP4263A Self-Test.vi.
    Possible reasons:
    VISA: (Hex 0xBFFF000E) The given session or object reference is invalid.
    your help would be very helpful
    thanks

  • How can I add advertisement code into flash game?

    hi mates,
    just want to ask about loading advertisement code!
    How do you add the advertisement code (adsense) into flash games??
    my site Funny Games have over 5k games but they are getting from others sites thus I have no original files. How can I add more code into the current files?

    Unless the games were pre-made to allow you to specify some variables in the page code or some external file, you won't be having any luck... you cannot add code to the games unless you have the source files, which you apparently don't have.

  • How can i get the code html and css of my form please help me

    how can i get the code html and css of my form

    HI,
    If you like to embed the HTML form in your web page then you will need to obtain the form code from the Distribite/Embed tab. Additional information can be found here: http://forums.adobe.com/docs/DOC-1991
    You will not be able to access/modify the css code or the rest of the form html code.  If you like to view the source of of a HTML page, please use your browser 'view source code' functionality.
    I hope this answer your question,
    Thanks,
    Lucia

  • How can i use ADF code in Trinidad

    Hi,
    I'm having an small Application which is Implemented to some extent using oracle ADF faces components But now, as the Trinidad is an open source i would like to do it in trinidad.
    If i replace the libraries to trinidad does my implement code in ADF Faces components needs to be Change,
    Please Suggest me how can use my ADF code in Trinidad.
    Thanks.

    Hi,
    Thanks for the Information a lot,it will helps me a lot.
    i am unable to navigate to down load the libraries given in oracle site in "How-to configure Apache Trinidad components in Oracle JDeveloper " can u help me,
    how can i get libraries to use in Oracle Jdeveloper for Trinidad.
    Can i use the libraries given on the Apache MyFaces Trinidad site (http://myfaces.apache.org/trinidad/download.html) but the libraries are different than the oracle given.
    Please Help me what libraries to used in Oracle jdeveloper 10g for trinidad.
    Thank You.

Maybe you are looking for

  • Entering numbers into Access

    I am using an update statement to enter a number into an access databse where the field is set as an interger format. The syntax used in the update statement is order = '#form.order#', When this is processed I revieve the following error: ODBC Error

  • New windows 8 laptop and 4S sync

    Need help . . . Have been using my Windows 7 notebook to sync and backup the 4S along with the cloud service. Copied the photo, apps, contact, and music to the new laptop with the Windows 8. The issue that I have is that the device recognizes the old

  • Painting on JPanel problem

    i am new in java and im practicing on GUI... i wrote this stupid GUI that draw shapes on a JPanel, when i minimize the window and maximize again shapes disapear, i have been told to use the paintComponent( ) instead of getGraphics( ) but i didnt know

  • Transaction ME21n (Will not run as a BACKGROUND SESSION)

    The requirement is to generate Purchase Orders (Stock Transport Orders to be precise). The RFC has to create a session which will be executed...say...before midnight to generate the sto (TC -> SM35). I have used BDC inside my RFC calling the transact

  • Selection tool in Illustrator is inconsistent! Shift select to add, alt select to deselect!

    Selection tool seems to be a popular topic in the feature request forums, but I didn't find anyone complaining about exactly the same thing I am going to suggest. If I want to select a bunch of points with the Direct selection tool I usually drag a m