Questions Uploads
Write a generic class Pair which has 2 type parameters, F and S
/in Questions Uploads /by Hannah WanguiQuestion
<ol><li>Write a generic class Pair which has 2 type parameters, F and S, representing the type of the
first and second elements of a pair respectively. </li><li>Add <em>get</em> and <em>set</em> methods for the first and second elements of the pair.</li><li>Override the toString() method to display the first and second values of the pair in a format of your choosing.</li><li>Use the Pair class in a program that creates an ArrayList of 10 Pair objects containing values of your choosing. The program will then print the string representation of each Pair to System.out (i.e., use the toString() method).</li><li>Take a screenshot of your output and paste it into the Word document you created for the first exercise, but place the screenshot under a header for âExercise 2.â</li></ol>
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"
Network Security Plan
/in Questions Uploads /by Hannah WanguiNeeding help with my CSIS 208 Assignment 8
/in Questions Uploads /by Hannah WanguiQuestion
Needing help with my CSIS 208 Assignment 8:Write a Visual Basic program to implement the cash register in
the diagram below. The program should have a class called CashRegister that keeps track of the balance and allows deposits and withdrawals. The class should not permit a negative balance. If the user tries to subtract a number that would result in a negative balance, the system should produce a messagebox indicating that the transaction would result in a negative balance, which is not permitted.
Here’s what I have and the code doesn’t work….I can get it to allow me to enter the text but the add/subtract buttons don’t work. I”m using Visual Studio
Public Class Form1
Dim Cash As New CashRegister
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If txtBalance.Text = “” Then
txtBalance.Text = “0”
End If
End Sub
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
txtBalance.Text = FormatCurrency(Cash.AddMethod(txtAmt.Text))
End Sub
Private Sub btnSubtract_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubtract.Click
txtBalance.Text = FormatCurrency(Cash.SubtractMethod(txtAmt.Text))
If txtBalance.Text MessageBox.Show(“Transaction would result in negative balance, which is not permitted!”)
txtBalance.Text = “0”
End If
End Sub
End Class
Class CashRegister
Public Balance As Integer
Public addAmt As Double
Public subAmt As Double
Public Property AddMethod(ByVal amount As String) As Double
Get
Return addAmt
End Get
Set(ByVal value As Double)
Dim x As Integer = amount
Dim y As Integer = amount
addAmt = x + y
End Set
End Property
Public Property SubtractMethod(ByVal amount As String) As Double
Get
Return subAmt
End Get
Set(ByVal value As Double)
Dim x As Integer = amount
Dim y As Integer = amount
subAmt = y – x
End Set
End Property
End Class
Thank you for your help
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"
About Us
![]()
Since 2010, we have offered professional writing services to clients all over the world.
Over the years, our writers have gained solid experience in all academic disciplines, giving them a competitive edge to provide only first-rate academic papers.
![]()
QUICK LINKS
Contact Us
For any questions, feedback, or comments, we have an ethical customer support team that is always waiting on the line for your inquiries.
Talk to us
support@academicheroes.com
Call us: +1 (564) -222 6836