Home VU Fall Assignment Solution CS506 Assignment No 2 Solution Fall 2023

CS506 Assignment No 2 Solution Fall 2023

by Adeel Ikram

CS506 Assignment No 2 Solution Fall 2023 – VU Assignment Solution – VU Fall Assignment Solution

The CS506 Assignment No 2 Solution Fall 2023 of Virtual University (VU) course assignment and I will share with you today the solution I came up with. Always come back to StudySolution for the most recent updates regarding the answers to your assignments.

CS506 Assignment No 2 Solution Fall 2023

Please visit our GDB section to traverse the Fall GDB Solution page if you find any GDB solutions for the Spring of 2024 and bring them to our attention. You are welcome to share your thoughts with us in the space provided below, and we will get back to you as quickly as possible.

Study Solution is an educational platform that offers students a free VU assignment solution to further their education. The solutions to the VU assignments provided by this site are the product of the professional and extensive experience of educators who are acknowledged authorities in their respective areas.

CS506 Assignment No 2 Solution Fall 2023 This assignment solution for Virtual University has been crafted with careful consideration given to the particular needs of the students as well as the course material. Study Solution provides a solution for completing assignments associated with Virtual University that is dependable, accurate, and up-to-date.

The VU assignment solution file will be available at no cost during the Fall 2023 semester. You can use all VU assignment solution files for your VU assignments. We can guarantee that if you use our VU assignment help, you will improve the grades that you receive on your assignments.

The Virtual University can be a complex learning environment, particularly for starting students. That is why we provide the Virtual University Assignment Solution to assist you. Don’t hesitate to contact us using the comment box to let us know about any Virtual University Assignment Solution requirements you may have.

CS506 Assignment No 2 Solution Fall 2023 The assignments play a significant role in the educational experience at VU, which is consistently ranked among the nation’s best universities. There are a lot of students who struggle to finish their VU assignments on time; this is where Study Solution comes in.

Assignment No. 2

Solution Fall 2023

CS506

Please Note this Before Submit Your Assignment:

  • Begin brainstorming ideas for your unique solution.
  • Quickly correct any errors you notice before submitting your assignment.
  • Please verify that your job meets all criteria before submitting it.
  • Notify us in the comments section if the Solution file contains any errors, and we will promptly make the necessary corrections.
  • Please ensure that your work meets all requirements before submitting it.
  • Do not submit the same file for the solution; incorporate the suggestions below to create a higher-quality solution file.
  • If there are any issues with the solution file or other errors, please inform us so we can address them immediately.
  • Make necessary corrections and double-check that your file functions correctly before submitting it.
  • Before submitting any of your tasks, ensure they have been thoroughly reviewed.
Students Can Get CS506 Assignment No 2 Solution Fall 2023 just By Visiting below.

Solution below

Index.html:

<!DOCTYPE html>

<html lang=”en”>

<head>

<meta charset=”UTF-8″>

<meta name=”viewport”  content=”width=device-width,  initial-scale= 1. 0 “>

-eBanis Transaction on-one>

<style>

body  {

font-family:  Arial,  sans-serif;

background-color:  #f4 f4 f4;

margin:  0; padding:  0; display:  flex;

align-items:  center;

justify-content:  center;

height:  1 00vh;

}

.container  {

background-color:  #fff; border-radius:  8px; padding:  40px;

box-shadow:  0 4px 8px rgba(0, 0, 0, 0.1);

text-align:  center; max-width:  400px; width:  100%;

}

input,  select {

width:  100%;

padding:  1 0px;

margin-bottom: 20px;

box-sizing: border-box;

}

button {

background-color: #4CAF50;

color: white; padding: 1 Opx 20px; border: none;
border-radius: 5px;

cursor: pointer;

}

</style>

</head>

<body>

<div class=”container”>

<h2>Banking Transaction Form</h2>

<form action=”TransactionServlet” method=”post”>

a.z1•

<label for=”initialBalance”>Initial Balance:</label> 50034

<input type=”number” id=”initialBalance” name=”initialBalance” required>

<label for=”transactionType”>Transaction Type:</label>

<select id=”transactionType” name=”transactionType” required>

<option value=” deposit”>Deposit</option>

<option value=”withdrawal”>Withdrawal</option>

</select>

<label for=”transactionAmount”>Transaction Amount:</label>

<input type=”number” id=”transactionAmount” name=”transactionAmount” required>

<button type=”submit”>Submit</button>

</form>

</div>

</body>

</html>

Transactio nServlet.j ava

import java.io.IOException;

import jakarta.servlet.ServletException;

importjakarta.servlet.annotation.WebServl:

import jakarta.servlet.http.HttpServlet;

iv»or iakaaser«let.sere«Request,

import jakarta.servlet.http.HttpServletResponse;

import jakarta.servlet.RequestDispatcher;

@WebServlet(“/TransactionServlet”)

public class TransactionServlet extends HttpServlet {

@Override

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws

ServletException, IOException {

double initialBalance = Double.parseDouble(request.getParameter(“initialBalance”)); String transactionType= request.getParameter(“transactionType”);
double transactionAmount = Double. parseDouble(request.getParameter(“transactionAmount”));

if(” deposit” .equals(transactionType)) {

initialBalance += transactionAmount;

} else if (“withdrawal”.equals(transactionType)) {

initialBalance -= transactionAmount;

}

request.setAttribute(“updatedBalance”, initialBalance);

RequestDispatcher dispatcher= request.getRequestDispatcher(“/BalanceServlet”);

dispatcher.include(request, response);

}
}

BalanceServlet.j ava

import java.io.IOException;

import jakarta. servlet. ServletException; import jakarta.servlet.annotation.WebServlet; import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;

import jakarta.servlet.http.HttpServletResponse;

 

 

@WebServlet(“/BalanceServlet”)

public class BalanceServlet extends HttpServlet {

protected void processRequest(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException {

double updatedBalance = (double) request.getAttribute(“updatedBalance”); response.getWriter().println(“<html><head><title>Transaction Result</title></head><body>”); response.getWriter().println(“<h2>Transaction Successful</h2>”); response.getWriter().println(“<p>New Balance: “+ updatedBalance + “</p>”); response.getWriter().println(“</body></html>”);
}

@Override

protected void doGet(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException {

processRequest(request, response);

}

@Override

protected void doPost(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException {

processRequest(request, response);

}

}

 

For More Latest Update Stay With Us.

Related Posts

Leave a Comment