Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

//What is wrong with this two files: import java.util.Scanner; public class TestScore1{ public static void main(String[] args) { int test1; int test2; int test3; double

//What is wrong with this two files:

import java.util.Scanner; public class TestScore1{ public static void main(String[] args) { int test1; int test2; int test3; double average; Scanner keyboard = new Scanner(System.in); testScoreAverage = new Average ();

System.out.print("Enter first test score "); testScoreAverage.settest1 = keyboard.nextint(); System.out.print("Enter second test score "); testScoreAverage.settest2 = keyboard.nextint(); System.out.print("Enter third test score "); testScoreAverage.settest3 = keyboard.nextint();

System.out.println("Average score " + getAverage()); } }

//Second one

class Average{ private int test1; private int test2; private int test3; private double average;

public void setTest1(int t1) { test1 = t1; } public void setTest2(int t2) { test2 = t2; } public void setTest3(int t3) { test3 = t3; }

public int getTest1() { return test1; } public int getTest2() { return test2; } public int getTest3() { return test3; }

public double getAverage() { return (test1+test2+test3)/3 ; } }

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

Step: 3

blur-text-image

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

Intelligent Information And Database Systems 12th Asian Conference ACIIDS 2020 Phuket Thailand March 23 26 2020 Proceedings

Authors: Pawel Sitek ,Marcin Pietranik ,Marek Krotkiewicz ,Chutimet Srinilta

1st Edition

9811533792, 978-9811533792

More Books

Students also viewed these Databases questions

Question

The company openly shares plans and information with employees.

Answered: 1 week ago