2legit2qwt's Posts
Nairaland Forum › 2legit2qwt's Profile › 2legit2qwt's Posts
1 2 3 4 5 6 7 8 ... 107 108 109 110 111 (of 111 pages)
@segsalerty, Thanks for that, I'll be trying that code in just a little bit and will let you know if it works for me. @mobinga, sesalerty, I'm reading all the vehicle info from the file. The user only has to enter the vin and then the program should be able to display that particular vehicle info. Where inventory comes in is that, on entering the vin, I'm trying to make it ask the user if they want to check out that car and if the user says yes, the inventory should have decrease by one car (the exact car that the vin was entered into the system by the user) Thank you so nuch for your help. |
Hi guys, I am working on this program that will read from a file and store each line in an array. However, I want each line stored in an array of an object which i created. I will really appreciate any help on this. I'm gonna paste the class I created which i want the array to be stored by line and also the text file I want to read into it. Here's my vehicle class public class Vehicle { private String vin; private String make; private String model; private int year; private String color; private double mileage; public Vehicle(String aVin, String amake, String amodel, int yr, String acolor, double mile){ vin= aVin; make = amake; model=amodel; year=yr; color= acolor; mileage= mile; rentalPrice= arentalPrice; } public String getvin(){ return vin; } public String getmake(){ return make; } public String getmodel(){ return model; } public int getyear(){ return year; } public String getColor(){ return color; } public double getmileage(){ return mileage; } public double getPrice(){ return Price; } public double getVehiclePrice(){ return lPrice; } } And the text file Vehicle information (vin, make, model, year, color, mileage, price) The objective of the program is to ask the user to enter the vin and then based on the vin, the program will display the vehicle information while reducing the inventory of that car model by 1. I need help with reading each line into the array and identifying each line by the vin. (hint on how to reduce the inventory will be greatly appreciated as well) Thank you . |
Hi guys, I am working on this program that will read from a file and store each line in an array. However, I want each line stored in an array of an object which i created. I will really appreciate any help on this. I'm gonna paste the class I created which i want the array to be stored by line and also the text file I want to read into it. Here's my vehicle class public class Vehicle { private String vin; private String rentalType; private String make; private String model; private int year; private String color; private double mileage; private double rentalPrice; private boolean rentalStatus = false; public Vehicle(String aVin, String rentType, String amake, String amodel, int yr, String acolor, double mile, double arentalPrice, boolean rentalS ){ vin= aVin; rentalType= rentType; make = amake; model=amodel; year=yr; color= acolor; mileage= mile; rentalStatus= rentalS; rentalPrice= arentalPrice; } public String getgetvin(){ return vin; } public String getrentalType(){ return rentalType; } public String getmake(){ return make; } public String getmodel(){ return model; } public int getyear(){ return year; } public String getColor(){ return color; } public double getmileage(){ return mileage; } public double getrentalPrice(){ return rentalPrice; } public void setrentalStatus(boolean rentalS){ if (rentalS = true) rentalStatus= true; } public boolean getrentalStatus(){ return rentalStatus; } public double getVehiclePrice(){ return rentalPrice; } } And the text file Vehicle information (vin, rental type, make, model, year, color, mileage, rental price, rental status) 1. 01X24, premium, Ford, Mustang, 2011, blue, 2356.03, 40.00, available 2. 01Y36, premum, Chevrolet, Camero, 2011, yellow, 785.94, 40.00, available 3. 01Z48, premium, Dodge, Challenger, 2011, black, 1382.28, 40.00, available 4. 11V48, standard, Honda, Accord, 2010, black, 7383.38, 30.00, available 5. 11V82, standard, Honda, Accord, 2011, silver, 2100.98, 30.00, available 6. 01M55, standard, Dodge, Charger, 2010, white, 3966.11, 30.00, available 7. 01B21, economy, Chevrolet, Aveo, 2010, red, 8291.56, 20.00, available 8. 01B36, economy, Chevrolet, Aveo, 2010, red, 9382.41, 20.00, available 9. 11B71, economy, Honda, Fit, 2011, blue, 4090.23, 20.00, available The objective of the program is to ask the user to enter the vin and then based on the vin, the program will display the vehicle information while reducing the inventory of that car model by 1. I need help with reading each line into the array and identifying each line by the vin. (hint on how to reduce the inventory will be greatly appreciated as well) Thank you . |
OH i thought as much, it was confusing. And you just saved me some painstaking hours trying to figure this out, i have been refreshing NL ever since my last post lol. there ain't no method or class I haven't tried yet, I just don't know how to execute them to fit this program. Thank you so much for that, i really appreciate your help. I should probably have stayed with my Computer Science instead of IS where you basically don't get to learn the classes in detail. |
@SayoMarvel So i realized you wrote that in Javascript?? or some other java coding i'm not familiar with. I'm a newbie and this is more like an introductory class so how can I change it to the regular java that i know? Like the one i posted in my first post? |
Sorry it took me this long to reply, I have been out of town since Friday. A big thank you to everyone who responded and offered to help out, i really appreciate it. @SayoMarvel Thanks a great deal, I will look at the code in a minute and give you feed back on it, thanks once again |
Java statement to reverse paragraph? |
Hi guys, Thanks for your help but fortunately for me, i was able to figure how to make everything work which is why I have not been able to check for any update on here. dellnet and T.Red i'm grateful to you both for willing to help. |
I meant a single even handler to handle the click events for all the operations +,-,*/ and /. Thanks for the response |
I am new to vb.net and i'm needing help with this small calculator program and will appreciate whoever can help me out. I am able to write the program to do the calculations right but my instructor specifically wants me to use a single event handler to handle all the operations like +,-,* and even = signs. It would have been easier for me if this was java because that's what i'm used to but not vb. Below is my code so far, Only the addition works now and i need to include codes for the other calculations using the same even handler i.e operations_click. some functions are not working but they should not affect the overall performance of the program. Please ignore the EqualsButton_Click, i'm the one using that to test first, it should be included in the Operations_click method and not stand alone. Thanks guys Public Class CalculatorForm Private FirstNumberInput As Double = 0 Private LastNumberInput As Double = 0 Private OperationCheck As Boolean = False Private Operation As String Private Sub OneButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OneButton.Click If ResultLabel.Text = "0" Then ResultLabel.Text = "1" Else ResultLabel.Text = ResultLabel.Text & OneButton.Text 'Appends the number "1" to user entry End If End Sub Private Sub TwoButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TwoButton.Click If ResultLabel.Text = "0" Then ResultLabel.Text = "2" Else ResultLabel.Text = ResultLabel.Text & TwoButton.Text 'Appends the number "2" to user entry End If End Sub Private Sub ThreeButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ThreeButton.Click If ResultLabel.Text = "0" Then ResultLabel.Text = "3" Else ResultLabel.Text = ResultLabel.Text & ThreeButton.Text 'Appends the number "3" to user entry End If End Sub Private Sub FourButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FourButton.Click If ResultLabel.Text = "0" Then ResultLabel.Text = "4" Else ResultLabel.Text = ResultLabel.Text & FourButton.Text 'Appends the number "4" to user entry End If End Sub Private Sub FiveButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FiveButton.Click If ResultLabel.Text = "0" Then ResultLabel.Text = "5" Else ResultLabel.Text = ResultLabel.Text & FiveButton.Text 'Appends the number "5" to user entry End If End Sub Private Sub SixButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SixButton.Click If ResultLabel.Text = "0" Then ResultLabel.Text = "6" Else ResultLabel.Text = ResultLabel.Text & SixButton.Text 'Appends the number "6" to user entry End If End Sub Private Sub SevenButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SevenButton.Click If ResultLabel.Text = "0" Then ResultLabel.Text = "7" Else ResultLabel.Text = ResultLabel.Text & SevenButton.Text 'Appends the number "7" to user entry End If End Sub Private Sub EightButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EightButton.Click If ResultLabel.Text = "0" Then ResultLabel.Text = "8" Else ResultLabel.Text = ResultLabel.Text & EightButton.Text 'Appends the number "8" to user entry End If End Sub Private Sub NineButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NineButton.Click If ResultLabel.Text = "0" Then ResultLabel.Text = "9" Else ResultLabel.Text = ResultLabel.Text & NineButton.Text 'Appends the number "9" to user entry End If End Sub Private Sub ZeroButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ZeroButton.Click If ResultLabel.Text = "0" Then ResultLabel.Text = "0" Else ResultLabel.Text = ResultLabel.Text & ZeroButton.Text 'Appends the number "0" to user entry End If End Sub Private Sub DecimalButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DecimalButton.Click ResultLabel.Text = DecimalButton.Text & "" 'clears the screen End Sub Private Sub Operations_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PlusButton.Click, MinusButton.Click, MultiplyButton.Click, DivideButton.Click FirstNumberInput = ResultLabel.Text ResultLabel.Text = "0" Operation = "+" End Sub Private Sub BackSpaceButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BackSpaceButton.Click, ClearEntryButton.Click, AbortButton.Click ResultLabel.Text = "0" End Sub Private Sub ResultLabel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ResultLabel.Click ResultLabel.Text = 0 End Sub Private Sub EqualsButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EqualsButton.Click Dim Result As Double LastNumberInput = ResultLabel.Text If Operation = "+" Then Result = FirstNumberInput + LastNumberInput ElseIf Operation = "-" Then Result = FirstNumberInput - LastNumberInput End If FirstNumberInput = Result ResultLabel.Text = Result End Sub End Class |
Ooh I remember Ohakim and I hope the people of Imo get who they want (Rochas) as Governor. Ohakim's son used to be my friend and from all that i know, that man (Ohakim) is really milking the state and certainly doesn't deserve a second term. If Nigeria has to change, people like the Ohakims shouldn't be in power. |
Thread----> waste of Seun's bandwidth. |
All too easy now, this team needs a better test than Ethiopia. |
I hope the FA organizes a friendly against a better team to really test this team. |
I think this is a better team than Chukwu's plus they look more organized than before, a better looking Super Eagles. |
Ok coverage is really bad and it's painful to the eyes but can we focus on the match? At least we are able to see it. |