Question
a) Specify all the data types (including classes) used in the program, giving one of the values used for each type. b) List all the
a) Specify all the data types (including classes) used in the program, giving one of the values used for each type.
b) List all the loop constructs used in the program and give the keywords and syntax required in each case. Where there is the possibility to use an alternative construct, say what this is.
c) Describe the sequence of operations when calling getSpend with P3 as the parameter. What will the returned value be?
d)Describe the sequence of operations when calling getSpend with P1 as the parameter. What will the returned value be?
e)How will an instance of this class appear when printed out, i.e, when supplied as an actual parameter in a call to System.out.println()?
1. Consider the following Java program, which consists of the class Spends. Notice this defines getSpend, isAmount and toString methods. Remember that Integer.parseInt applied to a String representation of an integer returns the integer in question public class Spends I d private String [ ] {"P1", "10", "15", "P2", "12", = public int getSpend (String id) i int spend0; boolean done = false; for (int i-0; iStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started