Top down program design is an approach to program design that starts with the general concept and repeatedly breaks it down into its component parts. In other words, it starts with the abstract and continually subdivides it until it reaches the specific. Consider creating the prime factorization of a number like 1540. The steps involved might look like:
1540
2 x 770
2 x 2 x 385
2 x 2 x 5 x 77
2 x 2 x 5 x 7 x 11
Top down program design works the same way. We start with the overall objective and wind up with a series of steps needed to accomplish it.
Answer:
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter a number: ");
int userVal = input.nextInt();
String aString;
if(userVal < 0)
aString = "negative";
else
aString = "non-negative";
System.out.println(aString);
}
}
Explanation:
Ask the user to enter a number and set it to userVal
Check the value of userVal. If it is smaller than 0, set the string as "negative". If it is not, set it as "non-negative"
Print the string
$ 75000 is the maximum amount that he can spend per month paying off credit cards and loans and not be in danger of credit overload.
More than this amount will exceed his income.
Answer:
I guessed D, taking it right now, sorry if it's wrong
Explanation: