Computers and Technology

This lab is designed to give you practice working with programmer defined methods. you will write a method named validate to a local banker. your method will need to utilize two input parameters and the method's return value (for its output).

getting started
to start this exercise, you should
open eclipse and start a new java project named lab09
add a class (named lab09) to this project.
cut the program from this document and paste (replacing everything) in the eclipse editor window.
lab09.java

/*
comment block here
*/

import java. util. scanner;
public class lab09
{
public static void main(string[] args)
{
scanner stdin = new scanner(system. in);
double curbal = 45.32;
double amount;
system. out. print(" enter a amount to update account by $");
amount = stdin. nextdouble();
system. out. print("\n");
system. out. print("customer\'s balance (before transaction) = $");
system. out. println(curbal + "\n");
system. out. print("requested update amount = $");
system. out. println(amount + "\n");
double actamount;
actamount = validate(curbal, amount);
curbal += actamount;
system. out. print("actual update amount = $");
system. out. println(actamount + "\n");
system. out. print("customer\'s balance (after transaction) = $");
system. out. println(curbal + "\n");
system. out. println(" you and good-bye! \n");
}

public static double validate(double bal, double amount)
{
// write your code here
return 0.0; // actual return value here (not 0.0)
}
}
problem description

1-read through the existing code to understand what it does and what is left for you to do.
2-compile and run the program as-is, to verify that you understand what it does and what is left for you to do.
3-write the missing code in the java program program provided so that it satisfies the following specification:
-for this part of the assignment you will be using the lab09.java file that you copied using the command above.
-a local banker has asked you to write a method named validate which takes :
-a customer's current balance
-the amount of money to update the account by :
a positive dollar amount is a deposit
a negative dollar amount is a withdraw

as input parameters, and then returns

-for deposits: the deposit amount is simpily returned by the function.
-for withdraws: the balance must not become negative. if a withdraw is requested for more than the current balance then the amount (which would zero the balance if withdrawn) is returned by the method. otherwise the withdraw amount is simpily returned by the method.

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 01:10, kristofwr3444
Are special combinations of keys that tell a computer to perform a command. keypads multi-keys combinations shortcuts
Answers: 1
image
Computers and Technology, 23.06.2019 05:00, bellad0124outlookcom
In cell b18, enter a formula to calculate the amount budgeted for meals. this amount is based on the daily meal allowance and the total travel days (# of nights+1).
Answers: 1
image
Computers and Technology, 23.06.2019 20:30, kaylee2828
Column a of irma’s spreadsheet contains titles for each row, but her document is too big and will be printed three pages across. she wants to be sure that every page will be understood. what can irma do to with this problem?
Answers: 3
image
Computers and Technology, 24.06.2019 04:30, shadenShaden2037
What is the process in which the software development team compiles information to determine the final product
Answers: 1
Do you know the correct answer?
This lab is designed to give you practice working with programmer defined methods. you will write a...

Questions in other subjects:

Konu
Mathematics, 17.12.2020 20:20