Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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:

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Azure SQL Database For Modern Developers Building Applications In The Microsoft Cloud

Authors: Davide Mauri, Silvano Coriani, Anna Hoffma, Sanjay Mishra, Jovan Popovic

1st Edition

1484263693, 978-1484263693

More Books

Students also viewed these Databases questions