Murach's C# 2015 Training & Reference: I need help with both Exercise 4-1.
I figured out steps 1-4, but not understanding how to modify the code for 5 & 6.
Code is:
private void btnCalculate_Click(object sender, EventArgs
e)
{
decimal subtotal
= Convert.ToDecimal(txtSubtotal.Text);
decimal
discountPercent = .25m;
decimal
discountAmount = subtotal * discountPercent;
decimal
invoiceTotal = subtotal - discountAmount;
txtDiscountPercent.Text = discountPercent.ToString("p1");
txtDiscountAmount.Text = discountAmount.ToString("c");
txtTotal.Text =
invoiceTotal.ToString("c");
txtSubtotal.Focus();
}
5. Modify the first statement in the btnCalculate_Click method so it uses the Parse method of the Decimal class instead of the ToDecimal method of the Convert Class. Then, test the application to verify that it still works the same.
6. Round the values that are stored in the discountAmount and invoiceTotal variables to two decimal places, and delete the formatting codes for the statements that covert these variables to strings. Then, test the application to make sure that only two decimal places are displayed for the discount amount and total.
5.
private void btnCalculate_Click(object sender, EventArgs e)
{
decimal subtotal =
Decimal.Parse(txtSubtotal.Text);
decimal
discountPercent = .25m;
decimal
discountAmount = subtotal * discountPercent;
decimal
invoiceTotal = subtotal - discountAmount;
txtDiscountPercent.Text = discountPercent.ToString("p1");
txtDiscountAmount.Text = discountAmount.ToString("c");
txtTotal.Text =
invoiceTotal.ToString("c");
txtSubtotal.Focus();
}
6.
private void btnCalculate_Click(object sender, EventArgs e)
{
decimal subtotal =
Decimal.Parse(txtSubtotal.Text);
decimal
discountPercent = .25m;
decimal discountAmount =
Math.Round((subtotal * discountPercent),2);
decimal invoiceTotal =
Math.Round((subtotal - discountAmount),2);
txtDiscountPercent.Text = discountPercent.ToString();
txtDiscountAmount.Text = discountAmount.ToString();
txtTotal.Text =
invoiceTotal.ToString();
txtSubtotal.Focus();
}
Do ask if any doubt. Please upvote.
Murach's C# 2015 Training & Reference: I need help with both Exercise 4-1. I figured out...
The Murach's Visual Basic 2015 Book And Visual Studio Exercise 7-2 Enhance the Invoice Total application If you did exercise 6-1 in the last chapter, this exercise asks you to add data validation and exception handling to it. 1. Copy the Invoice Total application from your C:\VB 2015\Chapter 06 directory to your Chapter 07 directory. This should be your solution to exercise 6-1 of the last chapter. 2. If your application has both a Sub procedure and a Function procedure...
6-1 Test and debug the Invoice Application
i need help with this please.. all help is appreciated
Source code Java:
import java.util.Scanner;
import java.text.NumberFormat;
public class InvoiceApp {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String choice = "y";
while (!choice.equalsIgnoreCase("n")) {
// get the input from the user
System.out.print("Enter customer type (r/c): ");
String customerType = sc.next();
System.out.print("Enter subtotal: ");
double subtotal = sc.nextDouble();
// get the discount percent
double discountPercent = 0.0;
switch(customerType) {...
C# Temperature Converter Application:
I have most of the application complete I just need only
help with error messages.
My instructor wants me to show four error messages
inside an error message label (not a message box) and all of the
error messages should appear inside error message label. The four
error messages should appear when:
1: User enters data inside both Celsius and fahrenheit
text boxes: “You should enter data in only one textbox. Press Clear
to start over.”...
Hi I have 4 problems below I need done ASAP, if you could upload them one by one by order you finish them instead of all at once that would be appreciated, I need this done in basic c++ code, all of the body structure are below I just need codes to be implemented for the codes to give the write outputs, Thank you. Q1. Update the given code 1 to implement the following problem: Create a class animal Set...
Visual Basic 2015: Extra 18-1 Use inheritance with the Inventory
Maintenance Application
Source Code:
1. frmNewItem.vb
Public Class frmNewItem
Public InvItem As InvItem
Private Sub frmNewItem_Load(sender As Object, e As EventArgs)
Handles MyBase.Load
Me.LoadComboBox()
End Sub
Private Sub LoadComboBox()
cboSizeOrManufacturer.Items.Clear()
If rdoPlant.Checked Then
cboSizeOrManufacturer.Items.Add("1 gallon")
cboSizeOrManufacturer.Items.Add("5 gallon")
cboSizeOrManufacturer.Items.Add("15 gallon")
cboSizeOrManufacturer.Items.Add("24-inch box")
cboSizeOrManufacturer.Items.Add("36-inch box")
Else
cboSizeOrManufacturer.Items.Add("Bayer")
cboSizeOrManufacturer.Items.Add("Jobe's")
cboSizeOrManufacturer.Items.Add("Ortho")
cboSizeOrManufacturer.Items.Add("Roundup")
cboSizeOrManufacturer.Items.Add("Scotts")
End If
End Sub
Private Sub btnSave_Click(sender As Object, e As EventArgs)
Handles btnSave.Click
If IsValidData() Then
InvItem = New InvItem(CInt(txtItemNo.Text),...
i need this in C# please can any one help me out and write the full code start from using system till end i am confused and C# is getting me hard.I saw codes from old posts in Chegg but i need the ful complete code please thanks. Module 4 Programming Assignment – OO Design and implementation (50 points) Our Battleship game needs to store a set of ships. Create a new class called Ships. Ships should have the following...
Need help writing beginner C# program, I will make sure to
provide feedback to whoever can help me figure it out!
No public or global variables should be used. You need to
consider passing arguments between the methods according to the
ways described in the lecture. i.e. all variables should be
declared inside the methods and passed to other methods by
value/ref/out as needed
Description: We want to design a Date class to represent a date using three integer numbers...
C# - Inheritance exercise
I could not firgure out why my code was not working. I was
hoping someone could do it so i can see where i went wrong.
STEP 1: Start a new C# Console Application project and rename its main class Program to ZooPark. Along with the ZooPark class, you need to create an Animal class. The ZooPark class is where you will create the animal objects and print out the details to the console. Add the...
Posting this again because day limit has run out. Again I really
need help with this. This is for my Advanced Java Programming
class. The book we use is Murach's Java Servlet's and JSP 3rd
Edition. The program used is NetBeans IDE 8.2. I need help
modifying or adding some code. I will post the code I was told to
open that needs to be modified below.
Exercise 9-3 Use
JSTL to add a table to the Future Value
application.
In...
Hi, I hope I can get some help with the following exercise in C++( CPP): 1.Write an additional method called push_back(int) that will add an integer to the end of the list. You can modify the provided code. 2.Modify the Node class and LinkedList class so that you can access your parent node (double linked-list). #include #include using namespace std; typedef int Type; enum Boolean { False = 0, True }; class Item { friend class SLList; public: Type getVal()...