Question: Please write code in Java. My professor gave me a preset code, but I messed with it too much. I am short fusing on how

 Please write code in Java. My professor gave me a preset

Please write code in Java. My professor gave me a preset code, but I messed with it too much. I am short fusing on how to write the strings that print the output.

This is what I have so far:

code, but I messed with it too much. I am short fusing

Create a class Problem Solution with following characteristics First constructor accepts two integer parameters Ni and N2 and displays addition of 2 numbers. Second constructor accepts three integer parameters N1, N2 and N3 and displays addition of 3 numbers. Input 10 20 45 where First line represents a value of N1. Second line represents a value of N2. Thrid line represents a value N3. Output 30 75 + Test Case(s) Problem Solution.java 1- import java.util.*; 3 public class ProblemSolution { 4 l/intializing instance variables 5 private int N1,N2; public ProblemSolution(int Ni, int N2) { //Paramterized constructor this.N1 = N1; this.N2 = N2; public int getAnswer() { //create method for first answer part return N1 + N2; public static void main(String[] args) { Scanner s = new Scanner(System.in); int N1 = s.nextInt(); int N2 = s.nextInt(); ProblemSolution problemSolution1 = new ProblemSolution (N1, N2); System.out.println(problemSolution1.getAnswer 26 }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!