• 0

please help i have this problem with this vb program its bloody hard t


Question

please i need help on this vb question

Please help I have this major problem with vb not that good but can you give me tips on finishing the code off and I have put the in details what problems does and the question that I need to do. I have this program with some missing data and some incorrect code. The xxxxxx signs are the variables and missing code.

The outline off the program

The file contains an unknown number of lines, each of contains three items of

data : x xxxxxxxxx?x x xxx., which is a string, xxxx xxx (integer), and xxxx xxxxxxxxx (also integer). The three data items are in order to shown, so a typical line in the file would have form.

?xxxx, x x?, 22990, 5220

showing xxxxx xxx of ?22990, and a xxxx xxxxxxxxx of ?5220 for. xxxxx, x x.

How ever, some of the figures for xxx and xxxxxxxxx are missing, and are represented in the file by -999. a line like.

?xxxxx, x?, -999, 0

for example, would indicate a missing value for xxxxx xxx, and xxxxx xxxxxxxxx of 0

A zero values does not indicate missing data.

?xxxxx, x?, 15225, -999

would indicate xxxxx xxx of ?15225 and a missing value for the xxxxx xxxxxxxxx.

When the program detects a missing value, it is to ask the user to enter it.

Apart from the possible presence of -999 to indicate a missing value, all of the numbers in the file may be to valid, i.e. to between 0 and 32767 (the maximum permissible integer). My program should assume that any missing data entered by the user also lie in this range.

The program is to take the figures for each xxxxxxxx in the file, and calculate the xxx xx xxxx, and the xxxxxxx?x xxxxxxxx, according to the following rules

? The xxxxxxx xx is to be calculated as the xxxxx xxx xxxxx xxx xxxxx xxxxxxxxx unless the xxxxx xxxxxxxxx is greater than the xxxxx xxx, in which case the xxxxxx xxx is 0

? xx xxx xx xxxx xx xxx xxxxx ?5000 xx xxx xxxxxxx xxx;

20% is xxxx xx xxxx ?10000;

45% is xxxx xx xxxxxxx xxxxx ?15000

xxx is to be calculated correct 2 decimal places

{ to calculate 20% of a figure, multiply it by 0.2: for 45% multiply by 0.45.}

? Anyone xxxxxx xx xxx xx xxxxxxxxxxxx xx ?xxx xxxxx?;

Anyone xxxxxx xxxx 20% xxx xx xxxxxxxxxxx xx ?xxxxxxxxx xxxxx?:

Anyone else is xxxxxxxxxxx xx ?xxxx xxxxx?

The program is to output the following line of information for each xxxxxxxx xxxx, xxxxx xxx, xxx , xxxxxxxxx

The output should be displayed in a picture box and also written to an output file named (I:xxx_xxxx.txt) the number of records dealt with so far should then be displayed in the text box.

After all of the input file is processed, the program is to display a message to tell the user that processing is complete.

I project xxxxxx.vbp has a partially completed interface, with two Command buttons, a text box, and a picture box. It also has some incomplete/ incorrect codefor function xxxxxxxx already entered, and numerour comments.

What needs to be done

1. write a subprogram xxxxxxxxx, to check whether there are missing values for the xxxxx xxx xxx/xx xxxxx xxxxxxxxx, and obtain any missing values from the user (i.e. to implement your refinement of step ?xxxxx xxx xxx xxxxx xxxxxxx xxxx?)

When the subprogram ends, the arguments should contain the complete set of data

2. The function xxxxxxxxxx is intended to take in the values, of the xxxxx xxx xxx xxxxx xxxxxxxx viathe first two parameters, and calculate the xxx xxxxxxx xxx xxx xxxxxxxx (?xxx xxxxxxx?, ?xxxxxxx xxxxx? xx ?xxxx xxxxxx?). The string representing the xxx xxxxxxx is to be stored in the argument; and the xxx xxxxxxx is to be returned as and logical errors. For this I need to rewrite the code.

3. The code for event procedure xxxxxxxx_xxxxx() requires a loop starting where indicate by the comments

?start of main processing loop

And finishing where indicated by the comment

?End of main processing loop

the code

----------------------------

Option Explicit

Dim xxxxxxxxxxx As Integer

------------------------------

Private Sub Form_Load()

'OPEN THE input file

'open the output file

'INITIALISE xxxxxxxxxxx

End Sub

2) ------------------------------------

Private Sub cmdDiscardWaste_Click()

'DECLARE LOCAL VARIABLES

'START THE MAIN PROCESSING LOOP

'GET next line of data from input

'increment xxxxxxxxxxx and display xxxxx in text box (xxxxxxxx)

'Check for and obtain missing data using sub xxxxxxxxxx

'Calculate xxx xxxxxxx AND xxxxxxxx using function xxxxxxxxxxx

'DISPLAY xxxxxxxxx 'x xxxxxxx in the picturebox (xxxxxxxxx)

'And store them in the outputfile

'End of main loop.

End Sub

3 )----------------------------------------------------------------

'Private Function xxxxxxxxxxx(xxx xx xxxxxxx, xxxxxxxxx xx xxxxxxxx, xxx xx xxxxxx)

Dim xxx xx xxxxxx, xxxxxxxxxx, xxxxxxxxxx xx xxxxxxx

xxxxxxxxxx = xxx - xxxxxxxxx

Select Case xxxxxxxxx

Case Is <= 5000

xxx = 0

xxx = "xxx xxxxxx"

Case 5001 xx 15000

xxx = 0.2 * (xxxxxxxxxx - 5000)

xxx = "xxxxxxxx xxxxxx"

Case xxxx

xxx = 0.45 * (xxxxxxxxxx)

End Select

End Function

______________________________________

Private Sub cmdQuit_Click()

'xxxx xxx xxxxx xxxxx

End Sub

-------------------------------------------------------------

cya naz

23 answers to this question

Recommended Posts

  • 0

the code i have worked some off it out still need help

------------------------------

Private Sub Form_Load()

'OPEN THE input file

'open the output file

'INITIALISE table

End Sub

2) ------------------------------------

Private Sub cmdDiscardWaste_Click()

'DECLARE LOCAL VARIABLES

'START THE MAIN PROCESSING LOOP

'GET next line of data from input

'increment table and display stuff in text box (money)

'Check for and obtain missing data using sub valid

'Calculate money AND stuff using function addup

'DISPLAY that is right in the picturebox (Picoutput)

'And store them in the outputfile

'End of main loop.

End Sub

3 )----------------------------------------------------------------

'Private Function addup(avg as integer, pmark as boolean, tmark as string)

Dim avg as integer, pmark as boolean, tmark as string

pmark = avg - tmark

Select Case pmark

Case Is <= 5000

avg = 0

avg = "this is valid"

Case 5001 => 15000

avg = 0.2 * (pmark - 5000)

avg = "this not valid"

Case else

avg = 0.45 * (pmark)

End Select

End Function

______________________________________

Private Sub cmdQuit_Click()

'end application

End Sub

-------------------------------------------------------------

1. write a subprogram xxxxxxxxx, to check whether there are missing values for the xxxxx xxx xxx/xx xxxxx xxxxxxxxx, and obtain any missing values from the user

When the subprogram ends, the arguments should contain the complete set of data

2. The function xxxxxxxxxx is intended to take in the values, of the xxxxx xxx xxx xxxxx xxxxxxxx viathe first two parameters, and calculate the xxx xxxxxxx xxx xxx xxxxxxxx (?xxx xxxxxxx?, ?xxxxxxx xxxxx? xx ?xxxx xxxxxx?). The string representing the xxx xxxxxxx is to be stored in the argument; and the xxx xxxxxxx is to be returned as and logical errors. For this I need to rewrite the code.

3. The code for event procedure xxxxxxxx_xxxxx() requires a loop starting where indicate by the comments

?start of main processing loop

And finishing where indicated by the comment

?End of main processing loop

the code

  • 0
  Quote
2. The function xxxxxxxxxx is intended to take in the values, of the xxxxx xxx xxx xxxxx xxxxxxxx viathe first two parameters, and calculate the xxx xxxxxxx xxx xxx xxxxxxxx (?xxx xxxxxxx?, ?xxxxxxx xxxxx? xx ?xxxx xxxxxx?). The string representing the xxx xxxxxxx is to be stored in the argument; and the xxx xxxxxxx is to be returned as and logical errors. For this I need to rewrite the code.
LOL. You're kidding, right? Do you really want me to reply like this?

"You're missing the xxxx xxxxx from the xxxxxxxx. Without xxxx/xxx, your code will be xxxxxxxxxxx inside the xxxxxxxxx. Your function, xxxxx_ xx_xxxx_xxx(), doesn't have the xxx xx xxx/xxx implemented correctly. Try using xx or x instead."

Seriously, what is this program used for? Do you have to keep this code secret or something? Usually, it helps if youvery clear and simpled simple description of what your program/assignment is supposed to do. For example:

"I'm writing a file parser, but my file won't open. I think the problem lies here..."

  • 0

its this part off the program i know its hard, that only thing i can't work out.

1. write a subprogram xxxxxxxxx, to check whether there are missing values for the xxxxx xxx xxx/xx xxxxx xxxxxxxxx, and obtain any missing values from the user

When the subprogram ends, the arguments should contain the complete set of data

6 working out stuff

  • 0

chill man, hes just trying to help you....its not our fault if we cant understand ur x's i mean what if i blur some **** like "@@@ @@@....@@()/@@ @@@ @@@@@@ @"

i mean dont expect us to understand what ur talking about......if u want us to understand well be more specific

  • 0

OIC. It's like madlibs for coders. Whoever made up an assignment with descriptions like this is on crack...

  Quote
The program is to take the figures for each xxxxxxxx in the file, and calculate the xxx xx xxxx, and the xxxxxxx?x xxxxxxxx, according to the following rules

The xxxxxxx xx is to be calculated as the xxxxx xxx xxxxx xxx xxxxx xxxxxxxxx unless the xxxxx xxxxxxxxx is greater than the xxxxx xxx, in which case the xxxxxx xxx is 0

xx xxx xx xxxx xx xxx xxxxx ?5000 xx xxx xxxxxxx xxx;

20% is xxxx xx xxxx ?10000;

45% is xxxx xx xxxxxxx xxxxx ?15000

xxx is to be calculated correct 2 decimal places

{ to calculate 20% of a figure, multiply it by 0.2: for 45% multiply by 0.45.}

Anyone xxxxxx xx xxx xx xxxxxxxxxxxx xx ?xxx xxxxx?;

Anyone xxxxxx xxxx 20% xxx xx xxxxxxxxxxx xx ?xxxxxxxxx xxxxx?:

Anyone else is xxxxxxxxxxx xx ?xxxx xxxxx?

  • 0

man not to say but i soo swear this is sumfing as easy as making a command button on the form

but gees its hard to understand the x's im getting lost

and i cant sit there coutning his x's lol

i dont think he even understands u want him to subsitute something for the x's

man can you give us an example??

of instead of using x's

use like if you wanted it to be like this

xxxxxx-xxxx

iamthe-best

that would be way easier to understand

  • 0

Oogle: Crack LOL

Naz ive got a tip for you, go the god damn lectures. How are we supposed to understand what your trying to write if you cant understand it yourself.

For incrementation in a loop you just need a simple thing near the end of the loop saying:

Let (variable) = (variable) + 1

If statement loop youd need something like a "FOR" loop with an If statement inside the loop so it keeps checking or someat like that.

Input box:

Let (variable) = inputbox("What you want user to do here"), vbOKCancel (i think thats valid cant remember)

Message box:

Let (variable) = Msgbox("Tell the user some rubbish"), vbOKOnly

for stuff like checking you need something like:

Sub txt(text box name)_change()

' Checks to see if there is a non-numerical value being entered into the box, if there is

' it display a prompt box for you to change it to a numerical value

Let frm(form name).txt(text box name).Text = Validatenum(frm(form name).txt(text box name).Text)

End Sub

That goes in the form code. Then in a module you need to put in something like this:

Public Function Validatenum(sInput)

While Not IsNumeric(Format(sInput, "general number"))

Let sInput = InputBox("Please enter a number only into the box")

Wend

Let Validatenum = sInput

End Function

This is basically how it works. The last thing can be executed when the user types something in. So whenever she hits a key it checks to see if its numerical, if not then an inpubox pops up and she is forced to type in a numerical value. It can also be executed onBlur (when the cursor is clicked elsewhere), onFocus (when the cursor is clicked in the box), onLoad, onUnload, when you click a command button (this is mostly best).

Using that little bit of checking code in different places like command buttons and stuff like that my program was unbreakable. You could have thrown a sledgehammer at it and it wouldnt have broke.

Hope that helps.

Oh and the bit about calculating stuff. Im sorry but if you cant even write a simple line to calculate something then you may as well give up now mate cus you aint got a hope in hell of getting loops.

if you want me to send you a program that i did for my mate for his first year at uni then PM me. Its very simple but should be able to help you loads.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Guess I'll be saving the APK for future use, screw that data-harvesting copilot crap...
    • Looks like it, I have them working after the update.
    • MEmu Android Emulator 9.2.6 (offline installer) by Razvan Serea MEmu is a FREE Android emulator that brings fun of the Android experience to Microsoft Windows devices. It runs on nearly all Windows devices (PC, notebook, 2-in-1 devices, tablets). Comparing to other Android emulators, MEmu provides the highest performance and greatest compatibility. The richest features: Full Android experience with an elegant desktop Flexible customization (CPU#, memory size, resolution, device model, nav bar location, root mode, etc.) Mapping the keyboard / joystick to screen touch for much better game experience Passing through sensor data (e.g. accelerometer) to Android, so you can play car-racing like games intuitively GPS location simulation File sharing between Windows and Android Fast APK installation by drag and drop One-click Android system creation / clone / deleting, and you can run multiple Android instances simultaneously Using MEmu, you can: Have fun playing Android games on PC Chat more conveniently by using keyboard in Whatsapp, Wechat, etc. Watch live show and TV channels Ten seconds to start Directly open several Android Emulator windows MEmu Android Emulator 9.2.6 changelog: Optimized the emulator GUI to support native Windows 11 style. Optimized APK export speed, automatically export to shared directory, and display export progress. Fixed an issue where APK export could occasionally result in incomplete files on Android 12 instance. Fixed graphical corruption issues in Project Net game. Download: MEmu 9.2.6 Offline Installer | 639.0 MB (Freeware) View: MEmu Home Page | MEmu Support Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • You already have local admin rights. It is not really as bad as they say.
  • Recent Achievements

    • Week One Done
      Yawdee earned a badge
      Week One Done
    • Week One Done
      eugwalker earned a badge
      Week One Done
    • First Post
      Ben Gross earned a badge
      First Post
    • One Month Later
      chiptuning earned a badge
      One Month Later
    • Week One Done
      harveycoleman123 earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      657
    2. 2
      +FloatingFatMan
      190
    3. 3
      ATLien_0
      145
    4. 4
      Xenon
      133
    5. 5
      wakjak
      107
  • Tell a friend

    Love Neowin? Tell a friend!