Concept explainers
Explanation of Solution
Given:Â The details of three students:
Snow White, student ID: A00234, credits: 24
Lisa Simpson, student ID: C22044, credits: 56
Charlie Brown, student ID: A12003P, credits: 6
To find:
A way to add three students.
A way to enroll them into labClass.
A way to use printlist() to print all the students of that class.
Solution:
Start BlueJ and then open a new project named lab-classes.
A new window will appear on screen in which each rectangular block will represent a class.
To create object of LabClass class, it is necessary for the user to right click on the LabClass class and then click on the new LabClass (int maxNumberOfStudents) from the pop-up menu. The parameter should be filled and the user can provide a specific name of instance and then click ok button.
A new red rectangle will appear at the bottom of the BlueJ screen labeled with the name of instance provided by the user.
To create object of Student class, it is necessary for the user to right click on the Student class and then click on the new Student (String fullName, String studentID) from the pop-up menu...
Want to see the full answer?
Check out a sample textbook solutionChapter 1 Solutions
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
- Python question please include all steps and screenshot of code. Also please provide a docstring, and comments through the code, and test the given examples below. Thanks. If there is a vote at a meeting, there are several possible outcomes based on the numberof yes and no votes (abstains are not counted). If all the votes are yes, then the proposalpasses "unanimously", if at least 2/3 of the votes are yes, then the proposal passes with"absolute majority", if at least 1/2 of the votes are yes, then the proposal passes by"simple majority", and otherwise it fails. Write function vote() that takes as input thenumber of yes votes and the number of no votes and then prints the outcome of the vote.>>> votes(9, 0)proposal passes unanimously>>> votes(6, 3)proposal passes with absolute majority>>> votes(5, 4)proposal passes with simple majority>>> votes(4, 5)arrow_forwardswitch_player(): we will allow the players to choose their own names, but for our purposes, it is easier to think of them as number (0 and 1, for indexing purposes). We will display their names to them on the screen, but in the background, we will keep track of them based on their number. This function should take 1 argument, an integer (either 0 or 1) representing the player and should return the opposite integer (1 if 0 is entered and 0 if 1 is entered). This is a simple function, but it will make our code cleaner later. Use your constants! Using Thonnyarrow_forwardWrite a program that uses scroll bars or slidersto select the color for a text, as shown in Figure . Four horizontal scrollbars are used for selecting the colors: red, green, blue, and opacity percentages.arrow_forward
- Complete the following code as instructed in the line comments. String title = "Dame" name = "Liz taylor", citizenship = "British American"; //Create a StringBuilder object called correctName and send it name. //Capitalize the 't' in "taylor". //Replace "Liz" with "Elizabeth". //Append a comma followed by a space to the object. //Append "you were a famous actress." to the object. //Print the object using an explicit call to toString (). //Use the stringBuilder object to call its toString () explicitly, then call split() to tokenize the String version of the StringBuilder object into an array called message. Use a space as the delimiter or separator. This is all one Java statement. //Code the header for an enhanced for to print the tokens from the message array. The variable to hold each token is called word. { System.out. ("%n%s", ); //Fill-in the correct method to print. Fill-in the correct argument. }//END enhanced forarrow_forward18. This keyword will stop the execution of more code and case testing inside the block. break continue None of the Choices default Give an explanation for the answer. Thank youarrow_forwardQ.Create an interesting educational information chat box that asks the user to give an input question and then answers the question given by user with a suitable answer. You can make use of list for different questions and answers.Save two to three answers for a single question and then for random selection of elements from those answers use random choice(list) method from random module that returns a random element. Also for a user question that doesn't matches with the questions present in the chat box it should display statement like "oops i can't answer that" "sorry i am not intelligent enough" "could u please ask something else" using random method so that every time one of these statements appear **coding language python ***try using basic programming techniques in python without using arrays and pointers * * * copy paste the program itself and also the screenshot of program and output * * * use any type of data for questions such as name details of cities species etc depends on…arrow_forward
- Extra 6-1 Develop the Temperature Converter In this exercise, you’ll use radio buttons to determine whether the conversion is from Fahrenheit to Celsius or vice versa. You’ll also modify the DOM so the labels change when a radio button is clicked, and the page displays an error message when the user enters invalid data. 1. Open the application in this folder: exercises_extrach06convert_temps 2. Note that the JavaScript file has some starting JavaScript code, including the $() function, three helper functions, three event handler functions, and a DOMContentLoaded event handler that attaches the three event handlers. 3. Review how the toCelsius() and toFarhenheit() event handler functions call the toggleDisplay() helper function and pass it strings to display. Also note that the toggleDisplay() helper function and the convertTemp() event handler function are incomplete. 4. Code the toggleDisplay() function so it changes the text in the labels for the text boxes to the values in the…arrow_forwardA Personal Fitness Tracker is a wearable device that tracks your physical activity, calories burned, heart rate, sleeping patterns, and so on. One common physical activity that most of these devices track is the number of steps you take each day. The file “steps.txt” at the following web link contains the number of steps a person has taken each day for a year. There are 365 lines in the file, and each line contains the number of steps taken during a day. (The first line is the number of steps taken on January 1st, the second line is the number of steps taken on January 2nd, and so forth.) Write a program that reads the file, then displays the average number of steps taken for each month. (The data is from a year that was not a leap year, so February has 28 days.) https://drive.google.com/file/d/1fBVZlrVC69MMkN- y1ICdUk2JVt4ia4L0/view?usp=sharing A successful test run of the program is as shown in the screenshot below:arrow_forwardButton Toggle How can we make a button that toggles a text view (not the button label) between "Howdy Class!" and "You Pressed Me!"? Please write the java onClick function that would be specified in the button onClick property. Do not use string comparison to determine the current state. Also, do not use hard code string values.arrow_forward
- 1. The main function creates 5 pixels with random red, green, and blue values. Complete the id_color function to return “red” if the red value is greater than the green and blue, “green” if the green value is greater than the red and blue, and “blue” if the blue value is greater than the red and green. If there is no clear maximum value (for example, if the red and green values are the same) return None. Do not change the main function.arrow_forward1. The main function creates 5 pixels with random red, green, and blue values. Complete the id_color function to return “red” if the red value is greater than the green and blue, “green” if the green value is greater than the red and blue, and “blue” if the blue value is greater than the red and green. If there is no clear maximum value (for example, if the red and green values are the same) return None. Do not change the main function. import imageimport random def id_color(p):'''Returns the dominant color of pixel p'''pass#Your code here to determine the dominant color and return a string identifying it#Hint: get the red, green & blue values and use an if statement to determine which has the highest value def main():'''Controls the program'''for i in range(5): #Loop 5 timesr = random.randrange(0, 256)g = random.randrange(0, 256)b = random.randrange(0, 256)print(r, g, b) #Show the pixel red, green & blue valuesnew_pixel = image.Pixel(r, g, b)print(id_color(new_pixel)) main()…arrow_forwardDo as directed. There is an application in which user may check subject check box and enter subject marks in relevant text field. In case of checking check box relevant text field state is changed to editable and by unchecking check box relevant text field state is changed to read only, you have to Write a code for “Total and Average Quality Points” button in which you have to calculate total points, average point and show in relevant fields. Also write code for click event of check boxes. Average Points = Total Points/Number of Coursesarrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,