Results 1 to 3 of 3

Thread: A level programming question

  1. #1
    Join Date
    Nov 2002
    Posts
    2,231
    Rep Power
    0

    Default A level programming question

    Ok my friends have a programming question that they need desperately for their A levels... i would like to help them but i currently have a c programming project doing for ma associates degree and i cant help them right now. So i turn to techjamaica to help them...

    Before i tell the question i dont want you all to think my friends are lazy the reason they have not been able to complete it is the main flaw in wolmer's computing program... in that they dont teach you programming pass structured programming (pseudocode algorithms) and they assume you know a programming language in the first place and alot of the people in 6th form dont know the language... i was fortunate in that i knew it enough to create my own last year when i was in these guys positions. The teaching of visual basic has just started at wolmers and it starts with 3rd form students so thats a good thing at long last. Um i dont know how many of you are willing but i asked kindly please

    Question 2
    This is a design an implementation task

    You are to design and create a very simple binary calculator using a high level language of your choice. A binary calculator can only use the digits 0 and 1. This calculator will allow the user to enter two unsigned binary numbers and will then allow the user to add, subtract, multiply or divide these numbers. In the case of division, the result should be truncated to a whole number. This is equivalent to integer division. The result is to be displayed in binary.

    To do this you are advised to follow these steps.

    (a) Design an interface that will allow the user to input two unsigned binary numbers and will display them in two boxes. The user should then be able to choose addition, subtraction, multiplication or division. There should be a box to show the result of a calculation. The user should be able to clear all the boxes. (No processing is required at this stage.) [4]
    (b) Create a function, called BinaryToDecimal, that will accept a binary number as a parameter and will return its decimal equivalent. For example,

    BinaryToDecimal(101101) will return the decimal value 45.

    You may use the following algorithm to do this.

    Input the binary number as a string
    Total = 0
    For each binary digit in the string, starting on the left,
    Total = Total * 2 + value of digit
    Return Total

    You should clearly annotate your code and use meaningful names for variables and other objects such as buttons and text boxes (if you use them). You should include a copy of your code as evidence.[4]
    (c) Create a function, called DecimalToBinary, that will accept a decimal number as a parameter and will return its binary equivalent. For example,

    DecimalToBinary (47) will return the binary value101111.

    You may use the following algorithm to do this.

    Input the decimal number call Number
    Binary = “” ‘Empty string
    Repeat
    Remainder = remainder after Number is divided by 2
    Number = Whole part of Number divided by 2
    Binary = String value of Remainder & Binary
    Until Number = 0

    & means concatenation. For example

    “1010” & “1” = “10101”
    You should clearly annotate your code and use meaningful names for variable and other objects such as buttons. You should include a copy of your code as evidence. [4]

    (d) Create code for each of the operations of addition, subtraction, multiplication and division. You are advised to change the binary numbers input by the user to decimal, do the operation and the convert the result back to binary before displaying it. You should include a copy of your code as evidence.
    (e) Create a set of test data that shows that the operations of addition, subtraction, multiplication and division work and provide evidence that you have used this data. Screen dumps are acceptable but must show the data entered and the result of the operation.
    Laptop: HP DV6700t - Core 2 Duo T9300 2.5Ghz, 3GB RAM, Nvidia 8400m GS, 250GB HDD. Ubuntu 12.04 and Windows 7
    Phone: Samsung Galaxy Nexus

  2. #2
    keroed1 Guest

    Default

    ok cool see wat ican do not sure if i can help though kinda busy at wrk along a project i am doing now but if anything might pass iton to some other guys on here i know

  3. #3
    Join Date
    Nov 2002
    Posts
    2,231
    Rep Power
    0

    Default

    Quote Originally Posted by keroed1
    ok cool see wat ican do not sure if i can help though kinda busy at wrk along a project i am doing now but if anything might pass iton to some other guys on here i know
    Thanx for trying but... it was due quite a long time ago. I helped them to the best that i could but i should find out by july whether it was good enough
    Laptop: HP DV6700t - Core 2 Duo T9300 2.5Ghz, 3GB RAM, Nvidia 8400m GS, 250GB HDD. Ubuntu 12.04 and Windows 7
    Phone: Samsung Galaxy Nexus

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •