Code a decision using an IF, THEN, ELSE statement (2 branch decision) Code a one branch decision using a null else statement The following is my answer: [CODE] program Negatives; {$APPTYPE CONSOLE} uses SysUtils, ourcrt; var balance, posNeg:integer; begin randomize; writeln ('Generating your bank balance'); writeln ('Please wait .....'); sleep (2000); //create a random number between 0 and 1000 balance:=random(1000); //randomly decide if the balance is negative //1 for positive, 0 for negative posNeg:=random(2); if posNeg=0 then begin balance:=balance*-1; writeln('Can you hear that sound? Its your cheque bouncing'); sound(200,1000); end else begin writeln ('Positive balance'); end; writeln('Your balance is ', …

Member Avatar
Member Avatar
+0 forum 4

Dear All, How do I display the pathname to the BASH shell of the Linux Terminal? Cheers,

Member Avatar
Member Avatar
+0 forum 2

Hi, Are there any web version of Delphi? It is because I cannot install the Delphi from my portable harddrive to the public computers. Cheers,

Member Avatar
Member Avatar
+0 forum 2

Dear All, Could you tell me what is / are wrong of the coding? Cheers,

Member Avatar
Member Avatar
+0 forum 1

Dear All, Could you tell me what is wrong or missing for my coding? Cheers, [CODE] unit Example3; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Edit1: TEdit; Edit2: TEdit; Edit3: TEdit; Edit4: TEdit; Edit5: TEdit; Button1: TButton; Button2: TButton; Edit6: TEdit; Edit7: TEdit; Label1: TLabel; Label2: TLabel; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var sum, average: integer; begin sum:=StrToInt(Edit1.Text)+StrToInt(Edit2.Text)+StrToInt(Edit3.Text)+StrToInt(Edit4.Text)+StrToInt(Edit5.Text); average:=sum div 5; Edit6.Text:=IntToStr(sum); Edit7.Text:=IntToStr(average); end; end. [/CODE]

Member Avatar
Member Avatar
+0 forum 24

Dear All, Please let me know what is wrong or missing for it from the attached document. One of them is my work (T9.zip) and the other is the demo Cheers,

Member Avatar
Member Avatar
+0 forum 3

Dear All, Could you tell me how to do for it? One of the zip is the demo2.zip and the other is my work. Please give me some of the ideas. Cheers,

Member Avatar
+0 forum 0

Dear ALL, Hi. Long time no see. How are you? I have come back to Programming class already. Could you tell me how can I start to VCL Forms Application if I use Delphi6? Cheers, turbomen

Member Avatar
Member Avatar
+0 forum 4

Dear ALL, I have bought a PC COMPAQ CQ2000AN in New Zealand. That model does not provided the restore kit in CD formation. I know the restore kit which is installed into the harddrive but now the PC was not work and cannot go to the windows screen and DOS prompt. I have tried to call the support of HP at Australia but she is on a holiday until 7th January, 2010. Could you tell me what I can do to solve the problem? I am not in New Zealand. Please help turbomen

Member Avatar
Member Avatar
+0 forum 2

Dear ALL, Could you tell me how can I do this kind of question if I do not working with the computer and please find the attached document for your reference - it is the answer of the question? [code] Complete the table below to show what each variable holds, the user enters the numbers 5, 6, 7, 8, 9 evens:=0; for count:= 1 to 5 do begin writeln('Please enter a number'); readln(numbers[count]); if (numbers[count] mod 2 = 0) then begin evens := evens + 1; end end; writeln(evens); [/code]

Member Avatar
Member Avatar
+0 forum 4

Dear ALL, Could you tell me what is wrong of my program? The problem is the following wording are often restart: "PLEASE RUN THIS PROGRAM IN A MAXIMUM WINDOW..., TONY YEUNG PRESENT... How can I add some music for it? How can I change the colour of the font and display into screen? [code] Program yeungkt2; {$APPTYPE CONSOLE} { IT113 Assignment - Who wants to be a student millionaire. Author: Tony Yeung Date: 16 October 2009 Version 2.03 } uses SysUtils,OurCrt; Type hotSeat_record=record lastname :string[12]; firstname :string[12]; address :string[25]; End; //***************** USED VARIABLES ****************************************** Var User_Choice :Integer; //global variable hotSeat_file …

Member Avatar
Member Avatar
-1 forum 2

Dear All, Could you tell me how can I read from the hotseat.txt file all the records and sort by first name. Finally, list the sorted results on the screen. Cheers, turbomen

Member Avatar
Member Avatar
-1 forum 2

Dear ALL, Could you tell me how can I write a program that writes to a text file, the 32 people that are in our hotSeat.txt file. Cheers, turbomen (p.s.: 'the question orginally ask me to write a program that writes to a text file, the 32 people that are in our hotSeat.dat file' but it is not possible for me to upload the *.dat file to here. So, I have make changes of the *.dat file to *.txt file before upload it.)

Member Avatar
Member Avatar
-1 forum 5

Dear Sir, Could you please give me some of the ideas of making the hotSeat game in pascal? The following is the simple mode of my coding:- [code] Program yeungkt1; {$APPTYPE CONSOLE} { Who wants to be a millionaire. Author: Chris Yeung Version 1 } uses SysUtils, OurCrt; Type hotSeat_record=record lastname:string[12]; firstname:string[12]; phone: string[12]; End; Var User_Choice:Integer; hotSeat_file:file of hotSeat_record; hotSeat:array[1..100]of hotSeat_record; numberRecords:integer; numbers: array[1..10] of integer; generate: boolean; Procedure load; Var count:integer; begin assign(hotSeat_file,'hotSeat.dat'); reset(hotSeat_file); numberRecords:= filesize(hotSeat_file); for count:= 1 to numberRecords do Begin read(hotSeat_file,hotSeat[count]); end; end; Procedure ContestantsList; Var count:integer; Begin numberRecords:= filesize(hotSeat_file); WriteLn; for count:= 1 to …

Member Avatar
Member Avatar
+0 forum 13

Dear Sir, Please help me on Delphi. Could you tell me how can I do the following question? Calculate and display the sum of the even numbers from 2 to 20 inclusive. Cheers,

Member Avatar
Member Avatar
+0 forum 7

Dear ALL, I have tried to demonstrate the card game problem by myself. The card game is come together with 52 cards. It has Spade, Heart, Club and Diamond - Spade > Heart > Club > Diamond. It has the integers and chars 2,3,4,5,6,7,8,9,10,J,Q,K,A. Could you tell me how can I code this program if we only play for 5 times. We choose 1 card in every time randomly. Cheers, turbomen

Member Avatar
Member Avatar
+0 forum 2

Dear Sir, I have made a question by myself. For example: I am playing the card game to my friend. The card has Spade, Heart, Club and Spade as usual but no number. How can I do if I only play five time and finally there is a record of the comparison XX : XX. The following is my answer: [code] program Spade; {$APPTYPE CONSOLE} uses SysUtils; var Count, Num, Computer : integer; Choice, compChar : char; begin Num:=0; Computer:=0; randomize; for Count:=1 to 5 do repeat writeln('Welcome to play the game of Spades'); readln(Choice); until (Choice = 'S') or …

Member Avatar
Member Avatar
+0 forum 8

Could you mind telling me what can I do for the following question? To write a skeleton program for the assignment. It should have a menu system with at least 5 options. The menu keeps repeating after each procedure is called. When one of the procedures is called just return a message to the screen saying what this procedure will do: ie “this is task 1” The menu options are: 1 Task 1 2 Task 2 3 Task 3 4 Task 4 0 Exit menu system (Hint: use a case statement) Cheers,

Member Avatar
Member Avatar
+0 forum 1

Dear All, Could you mind telling me how to code with the card game? It has 52 cards and it comes together with Spade, Heart, Club and Diamond. There are 2 people play together for 8 times, after it, we will get the result of it. Cheers,

Member Avatar
Member Avatar
+0 forum 3

Dear Sir, Could you tell me how can I do the following question? A positive integer is entered from the keyboard. If it's even, all even integers from 2 up to and including the entered integer are displayed. If odd, all odd integers from 1 up to and including the entered integer are summed, and the sum displayed. For example if the number entered was 20, the display would be: 2 4 6 8 10 12 14 16 18 20 Alternatively, if the number entered was11, the display should be: 36 Cheers,

Member Avatar
Member Avatar
+0 forum 1

Dear Sir, Could you tell me what is (are) wrong of the following answer:- Question:- Create the first half of a game of rock, paper, scissors. Ask the user for R, P or S. Get the computer to generate 0,1or 2. Now convert the computer’s number to R, P or S using a case statement. Tell the user what the computer picked. Draw an Activity Diagram first. Can you finish the rock, paper, scissors game? One solution to working out who won is the following: check whether it was a draw ie player=computer else check if the player won ie …

Member Avatar
Member Avatar
+0 forum 10

Dear ALL, Could you tell me how can I get num1, num2 and Output 2 for the following programme. [code] program Project2; {$APPTYPE CONSOLE} uses SysUtils, ourcrt; var num1, num2: integer; begin num2:=0; repeat num1:=num2+1; if (num1 mod 2=1) then begin writeln(num2); end else begin num1:=num1+1; end; num2:=num2+1; until num2>4; readln; end. [/code]

Member Avatar
Member Avatar
+0 forum 3

Dear Sir, I have got the answer of the following question but I do not understand why it has been done in this way: 3. Your task is to create a game of Heads or Tails against the computer. Write a program that asks the user for Heads or Tails, then simulates a toss of a coin and then tells the user whether they have guessed correctly. Question:- First, draw an activity chart that matches the pseudocode provided below. Convert the pseudocode to Delphi: DISPLAY a title for the program Issue the statement that stops your random numbers always coming …

Member Avatar
Member Avatar
+0 forum 1

Dear Sir, I have got confused to the real / integer. Would you mind helping to express it to me? I have got the answer of the following question: Write a menu system for the currency exchange program. My menu could look like this: Exchange rates How much money would you like to exchange? Press 1 for Australian dollars 2 for US dollars 3 for English pounds 4 for Japanese yen 5 for Euros 6 for Indian rupees 7 for PNG kina 8 for SA rand My answer: [code] program Conversion_with_menuII; {$APPTYPE CONSOLE} uses SysUtils; const aus=0.9024; us=0.7697; eng=0.3803; y=0.9144; …

Member Avatar
Member Avatar
+0 forum 4

Dear Sir, It is a simple example using a string. [code] program dowhile; {$APPTYPE CONSOLE} uses SysUtils, OurCrt; var my_words : string; begin my_words := ''; writeln('Enter some words (type "stop" to finish):'); readln(my_words); while (my_words <> 'stop') do begin clrscr; Writeln('You typed:'); writeln(my_words); writeln; writeln('Enter some words (type "stop" to finish):'); readln(my_words); end; writeln; writeln('This program has finished now'); end [/code] But it does not work. Could you tell me what's wrong of it?

Member Avatar
Member Avatar
+0 forum 3

Dear Sir, I have got a serious problem to understanding of the answer. The question is: Create the first half of a game of rock, paper, scissors. Ask the user for R,P or S. Get the computer to generate 0,1 or 2. Now convert the computer's number to R, P or S using a case statement. Tell the user wht the computer picked. The following is my answer: [code] program RPS5; {$APPTYPE CONSOLE} uses SysUtils, ourcrt; var Computer : integer; Choice, Move : char; begin randomize; repeat writeln('Rock(R), Paper(P), Scissors(S)'); readln(Choice); until (Choice = 'R') or (Choice = 'P') or …

Member Avatar
Member Avatar
+0 forum 3

Dear Sir, Could you tell me how can I do this question? Write a program that will readin three numbers nd output a message indicating whether or not the numbers were entered in ascending numerical order. (Equal entries are regarded as being in order, e.g. 4 4 5 is OK). Cheers,

Member Avatar
Member Avatar
+0 forum 4

Dear Sir, Please find the attached document for your reference. Could you tell me what is wrong of my answer? [code] program Project1; {$APPTYPE CONSOLE} uses SysUtils; var balance, posNeg, positive, negative: integer; begin randomize; writeln('Get average balance'); balance:=random(10000); posNeg:=random(2); if posNeg=0 then begin balance:=balance*-1-30; end else begin writeln('Positive balance.'); balance:=balance*1.03; end; writeln('Your balance is ', balance); readln; end. [/code] Cheers,

Member Avatar
Member Avatar
+0 forum 6

May I ask you a question on Delphi? The following is my question: Write a program that asks for two numbers from the user. Add these numbers together and store them. Then output to the screen the equation with the correct answer. Eg please enter a number 28 please enter another number 3 thank you 28 + 3 = 31 But I do in this way: [code] program sumof2numbers; {$APPTYPE CONSOLE} uses SysUtils; Var number1, number2, total: integer; begin writeln ('Please enter a number'); readln (number1); writeln ('Please enter another number'); readln (number2); total :=number1+number2; writeln ('The total of the …

Member Avatar
Member Avatar
+0 forum 6

Dear Sir, Could you tell me what is wrong of my program? The question is: write a progrm that totals up a list of exactly 100 numbers and outputs that total to the screen, also show the average of the 100 numbers. My program: [code] program Project2; {$APPTYPE CONSOLE} uses SysUtils; var total, number, count: integer; average: real; begin total:=0; for count:=1 to 100 do begin readln(number); total:=total+number; end; writeln(total); average:=total/100; writeln(average:6:2); end.[/code]

Member Avatar
Member Avatar
+0 forum 2

The End.