Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
DouglinhasZN

Mobile Calculator > URGENT!

Recommended Posts

Posted · Original PosterOP

ive posted in another forum and i got no answers so im trying it on here.

Im sorry if  posting in the wrong section, I couldnt find the right one.
Im quite new to programming and I dont know very much about it, however I've been set a work that I cannot complete as Im unable to write codes.
This work asks me to create an mobile phone calculator which will calculate the 3g and 4g mobile phones including 20% VAT.
I honestly have no idea how to create this program and I really need help because this is due this week and I have no clue how to do it.
Ive put the picture of my calculator below if it helps. Thanks guys so much ! I really need guidance
THANKS IN ADVANCE !!!!!!! 

 

also in the picture right at the bottom corner there is this text "numbers of text sent" and underneath it theres a repetition of the same text, its suppose to be "MB's of internet"

 

Thanks

post-184645-0-15095600-1421064099.png

Link to post
Share on other sites

yh but im at home and i dont have microsoft visual studio so i cant access it (lol seriously?)

then go home and access to visual studio or connect to your pc via rdp or team viewer (yeah seriously).


y'all need to poop more often.

Link to post
Share on other sites

If ya can't do it then don't.


Awareness is key. Never enough, even in the face of futility. Speak the truth as if you may never get to say it again. This world is full of ugly. Change it they say. The only way is to reveal the ugly. To change the truth you must first acknowledge it. Never pretend it isn't there. Never bend the knee.

 

Please quote my post in your reply, so that I will be notified and can respond to it. Thanks.

Link to post
Share on other sites
Posted · Original PosterOP

then go home and access to visual studio or connect to your pc via rdp or team viewer (yeah seriously).

iam at home and the visual studio is at college

Link to post
Share on other sites

— Irrelevant comment deleted —


ON A 7 MONTH BREAK FROM THESE LTT FORUMS. WILL BE BACK ON NOVEMBER 5th.


Advisor in the 'Displays' Sub-forum | Sony Vegas Pro Enthusiast & Advisor


  Tech Tips Christian Fellowship Founder & Coordinator 

Link to post
Share on other sites

iam at home and the visual studio is at college

install visual studio to your own pc? seriously why is it so hard?


y'all need to poop more often.

Link to post
Share on other sites

I need help on the coding not changing labels lol

 

 

 

Download Sublime Text 2 ,  open and parse  almost every language . then you just compile it through command line.

Also, that's what you get for creating a GUI from IDE without knowing how to code it in background.

 

Link to post
Share on other sites

Not sure what you expect anyone else to be able to do when you don't even include the code you already have...

 

What are you even having trouble with? This should just be a case of getting the values from the inputs and doing a bit of basic maths with them

Link to post
Share on other sites

I am confused why everyone is being so harsh. Grow up people, he needs help and you are not being helpful at all.

 

I am assuming you are using C#:

 

As for changing your program, you can either edit the form.cs file with notepad++ which is what contains the actual code or you can download visual studio from the Microsoft website. There should be like a trial version or express version but since you are not creating anything too complicated they should work fine.

Link to post
Share on other sites

It'll probably be easier to install VS on your own computer than to figure out how to build it through the command line. Or if your school lets you remote into your account, you can do that and access VS there.

 

Aside from your label issue, what else are you having trouble with?

Link to post
Share on other sites
Posted · Original PosterOP

I am confused why everyone is being so harsh. Grow up people, he needs help and you are not being helpful at all.

 

I am assuming you are using C#:

 

As for changing your program, you can either edit the form.cs file with notepad++ which is what contains the actual code or you can download visual studio from the Microsoft website. There should be like a trial version or express version but since you are not creating anything too complicated they should work fine.

thanks, idk why people being so mean either.. im new to this

 

It'll probably be easier to install VS on your own computer than to figure out how to build it through the command line. Or if your school lets you remote into your account, you can do that and access VS there.

 

Aside from your label issue, what else are you having trouble with?

Im having trouble with the actual code. Im pretty new to all this and I have no idea where to start from. I just need guidance

Link to post
Share on other sites

How/why have you been set work that you do not know how to do? What class is this for?

 

You have shown us that you have created the form. Associated with that form, Visual Studio will have automatically generated some code to go with it.

All that you need to do is attach a single function to the click event on the "calculate button" and in that function take all the inputs and calculate the output(s) and then display them.

Link to post
Share on other sites

im starting to do some coding ill post here as soon as im done to  get some guidance, thanks guys

That'll help us help you. Right now, it's not clear what you need help with. Just saying "having trouble with the actual code" doesn't give us any idea what you actually need help with. You need to be more specific. So when you post a piece of code, tell us what you're trying to do and what problems you're having.

 

And don't forget to use code tags when posting code on the forums. You can use the < > symbol above where you write your posts or you can manually place it between tags like so

[code]// Place you code between the [code][/code] tagspublic class Example{    public Example()    {        // Do something    }    // Rest of code ...}[/code]

This makes your code more readable.

Link to post
Share on other sites
Posted · Original PosterOP
[code]Public Class SwampPhones    Dim Customer_Name As String    Dim House_number As String    Dim Post_code As String    Dim Mobile_number As String    Dim costs_of_phone_calls_made As Decimal    Dim cost_of_text_sent As Decimal    Dim cost_of_internet_usage As Decimal    Dim total_monthly_bill As Decimal    Dim numbers_of_minutes_used As Single    Dim number_of_texts_sent As Single    Dim mbs_of_internet As Single    Private Sub btn1_Click(sender As Object, e As EventArgs) Handles btncalculate.Click        Dim diff As Decimal        Dim temp_cost_of_phone_calls_made As Decimal        Customer_Name = txtcust.Text        House_number = txthouse.Text        Post_code = txtpost.Text        Mobile_number = txtmobile.Text        'costs_of_phone_calls_made = txtcost1.Text        txtcost1.Text = costs_of_phone_calls_made        'cost_of_text_sent = txtcost2.Text        txtcost2.Text = cost_of_text_sent        'cost_of_internet_usage = txtcost3.Text        txtcost3.Text = cost_of_internet_usage        'total_monthly_bill = txtcost4.Text        txtcost4.Text = total_monthly_bill        If rbt1.Enabled = True Then            If costs_of_phone_calls_made <= 500 And cost_of_text_sent <= 500 And cost_of_internet_usage <= 500 Then                total_monthly_bill = "£20"                txttotalcost.Text = total_monthly_bill            End If            If costs_of_phone_calls_made = 500 Then                diff = costs_of_phone_calls_made - 500                temp_cost_of_phone_calls_made = diff = 0.2                ' msgbox(temp_costs_phone_calls_made)            End If        End If        MsgBox(Customer_Name)        MsgBox(House_number)        MsgBox(Post_code)        MsgBox(Mobile_number)        MsgBox(costs_of_phone_calls_made)        MsgBox(cost_of_text_sent)        MsgBox(cost_of_internet_usage)        MsgBox(total_monthly_bill)    End SubEnd Class[/code]

this is the coding ive done so far

 

 

Link to post
Share on other sites
Posted · Original PosterOP
[code]Public Class SwampPhones    Dim NS As Single    Dim Customer_Name As String    Dim House_number As String    Dim Post_code As String    Dim Mobile_number As String    Dim costs_of_phone_calls_made As Decimal    Dim cost_of_text_sent As Decimal    Dim cost_of_internet_usage As Decimal    Dim total_monthly_bill As Decimal    Dim numbers_of_minutes_used As Single    Dim number_of_texts_sent As Single    Dim mbs_of_internet As Single    Private Sub btn1_Click(sender As Object, e As EventArgs) Handles btncalculate.Click        Dim diff As Decimal        Dim temp_cost_of_phone_calls_made As Decimal        Customer_Name = txtcust.Text        House_number = txthouse.Text        Post_code = txtpost.Text        Mobile_number = txtmobile.Text        'costs_of_phone_calls_made = txtcost1.Text        txtcost1.Text = costs_of_phone_calls_made        'cost_of_text_sent = txtcost2.Text        txtcost2.Text = cost_of_text_sent        'cost_of_internet_usage = txtcost3.Text        txtcost3.Text = cost_of_internet_usage        'total_monthly_bill = txtcost4.Text        txtcost4.Text = total_monthly_bill        '  If rbt1.Enabled = True Then        'If costs_of_phone_calls_made <= 500 And cost_of_text_sent <= 500 And cost_of_internet_usage <= 500 Then        'total_monthly_bill = NS        '    txtcost4.Text = total_monthly_bill        temp_cost_of_phone_calls_made = txtminutesused.Text        If temp_cost_of_phone_calls_made > 500 Then            temp_cost_of_phone_calls_made = 0        Else            temp_cost_of_phone_calls_made = (-500) * 0.2        End If        txtcost1.Text = temp_cost_of_phone_calls_made        If costs_of_phone_calls_made = 500 Then            diff = costs_of_phone_calls_made - 500            temp_cost_of_phone_calls_made = diff = 0.2            ' msgbox(temp_costs_phone_calls_made)        End If        'End If    End Sub    Private Sub rbt1_CheckedChanged(sender As Object, e As EventArgs) Handles rbt1.CheckedChanged        NS = 20    End Sub    Private Sub rbt2_CheckedChanged(sender As Object, e As EventArgs) Handles rbt2.CheckedChanged        NS = 25    End SubEnd Class[/code]

ive changed abit, but its very confusing to me. Any help is welcome

Link to post
Share on other sites

this is the coding ive done so far

 

Here are some things I'd like to point out about your code. (edit: this is for the first piece of code you showed us. I was typing it while you posted the second)

 


 

While this code here isn't wrong

Public Class SwampPhones    Dim Customer_Name As String    Dim House_number As String    Dim Post_code As String    Dim Mobile_number As String    // etc

the convention is to use an access modifier (Private, Public, etc) instead of Dim when declaring fields

Public Class SwampPhones    Private Customer_Name As String    Private House_number As String    Private Post_code As String    Private Mobile_number As String    // etc


 

You need to assign these variables values before adding them to the text box

// None of the variables have been assigned so they only have their default valuestxtcost1.Text = costs_of_phone_calls_madetxtcost2.Text = cost_of_text_senttxtcost3.Text = cost_of_internet_usagetxtcost4.Text = total_monthly_bill

I'm not sure if that's what you want or if the commented out lines are what you really want

costs_of_phone_calls_made = txtcost1.Textcost_of_text_sent = txtcost2.Textcost_of_internet_usage = txtcost3.Texttotal_monthly_bill = txtcost4.Text

If that's what you want then you should manually convert the values. TryParse is helpful because you can handle what happens if a value isn't correct (for example if the user types in invalid input)

// The following will try to convert the value in txtcost1.Text to a Decimal.// If it fails, it will display a message to the user and exit the sub so the rest// of the code isn't being executeIf Not Decimal.TryParse(txtcost1.Text, costs_of_phone_calls_made) Then    MessageBox.Show("Invalid input", "Error")    Exit SubEnd If// If the above TryParse function is true, then you don't need to do anything// because the value from txtcost1.Text will already be put in costs_of_phone_calls_made


 

Which leads me to another convention

// useMessageBox.Show(...)// instead of MsgBox(...)


 

Finally, I don't think you mean to have the extra equals sign in this piece of code.

temp_cost_of_phone_calls_made = diff = 0.2// this is testing whether diff is equal to 0.2 and then assigning that true/false value to the variable// it would be equivalent to the following which certainly isn't what you intendDim isEqual As Boolean = (diff = 0.2)temp_cost_of_phone_calls_made = isEqual
Link to post
Share on other sites

ive changed abit, but its very confusing to me. Any help is welcome

 

Again, you're going to have to be more specific as to what parts are confusing you. You're writing the code so you must at least have a basic understanding of what you're writing.

Link to post
Share on other sites
Posted · Original PosterOP

Again, you're going to have to be more specific as to what parts are confusing you. You're writing the code so you must at least have a basic understanding of what you're writing.

man you have been of a great help.. I have little to no understanding, the coding that I code was from a friend guiding me.

 

the part where im confused is that I dont know how to make the calculator include 20% VAT on the calculation.

also on the last update of the code that I've posted I tried making the 3g and 4g button work, however im not 100% sure if the 4g button work or if any of the calculation work.

 

Although I know it would be too much for u to help me more than u already are, is there any possible website that might help me figure this problem out and even learn the basic of programming ?

 

Thanks again

Link to post
Share on other sites

the part where im confused is that I dont know how to make the calculator include 20% VAT on the calculation.

 

I'm not familiar with VAT but after looking it up it just seems like the same taxes we have so it's just basic math

// I assume this is the basic calculation you need for 20% VATtotal_with_vat = total * 1.2// ortotal_with_vat = total + total * 0.2 // does the same as the above// Example20% VAT added to £100 is £120100 * 1.2 = 120100 + 100 * 0.2 = 100 + 20 = 120

So just do up your total and then add the VAT to it.

 

 

also on the last update of the code that I've posted I tried making the 3g and 4g button work, however im not 100% sure if the 4g button work or if any of the calculation work.

 

Both buttons look like they will work fine with the way you coded them in. When you change from 3G to 4G it will run rbt1_CheckedChanged first followed by rbt2_CheckedChanged. When you change from 4G to 3G it will run rbt2_CheckedChanged first followed by rbt1_CheckedChanged. So it will run the event for the button that loses it's selection, then it will run the event for the button that is selected.

 

 

Although I know it would be too much for u to help me more than u already are, is there any possible website that might help me figure this problem out and even learn the basic of programming ?

 

I don't mind continuing to help but here are some links to VB.NET tutorials

I haven't used any of them personally so I hope they are decent. 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×