Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1.Write a constructor for the Course class that takes a String to represent the course subject and an int to represent the course number. It

1.Write a constructor for the Course class that takes a String to represent the course subject and an int to represent the course number. It should ensure that the subject is at most 4 characters long and is all capitalized, and that the number is between 400 and 799 (defaulting to 401 if an invalid number was enetered.)

You may find the method Character.toUpperCase helpful in this task.

image text in transcribed

Grading 6 Save Run Tests Full Screen new Coursel "CS", 300 ) 0 / 0 pts - Click for details FAILED Course.java New 1 - public class Course{ 2 3 private String subject; 4 private int number; 5 6 // YOUR CODE HERE 7 8- public String toString(){ 9 return subject + " " + number; 10 } 11 12 } new Coursel "CS", 416 ) 0 / 0 pts - Click for details FAILED new Coursel "CS", 999 ) 0 / 0 pts - Click for details FAILED new Coursel "math", 425 ) 0 / 0 pts - Click for details FAILED new Coursel "MATH", 425 ) 0 / 0 pts - Click for details FAILED new Coursel "MATHEMATICS", 425 ) 0 / 0 pts - Click for details FAILED

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

Database Principles Programming And Performance

Authors: Patrick O'Neil, Elizabeth O'Neil

2nd Edition

1558605800, 978-1558605800

More Books

Students also viewed these Databases questions

Question

Fill in the missing data for question 2 9 ( b ) .

Answered: 1 week ago

Question

13-1 How does building new systems produce organizational change?

Answered: 1 week ago