Pearson eText for Starting out with Visual C# -- Instant Access (Pearson+)
5th Edition
ISBN: 9780137502783
Author: Tony Gaddis
Publisher: PEARSON+
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 7.7, Problem 7.18CP
Write a statement that assigns the value 50 to the very last element in the values array declared in Checkpoint 7.17.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Challenge 3: Scores.java and TestScores.java
Implement a Scores class. The class constructor should accept an array of scores as its argument. The class should have a method that returns the average of the scores. If any score in the array is negative or greater than 100, the class should throw an IllegalArgumentException.
Implement a TestScores class that creates an array and fills it with numbers given by the user. It should catch the exception thrown when the user enters an illegal value.
Write code for a test class with the following details:1. Create an object of each class mentioned in Question 3, assuming the values for the data members of each class. Create an array that takes the objects of ALL the classes as its elements. Write an enhanced for loop to display the object details.
2. the dealer in Question 4 decides to offer 2% percent discount on the commission at runtime. Write codewith explanation. 3. Add code to the test class that writes the invoice details of Question 6 to a txt document
Syntax of the q3 code is given below:
import java.util.*;
class Car{ //class car
String[] name;
int reg_number,eng_number, chassis_num,status;
String[] city, model, color, date_reg,date_arr,type;
float price;
float abstract calculate (float price);
}
class Dealer extends Car{ //inherits from Car
String[] deal_name, deal_id, deal_add, deal_pno;
float dealer_com ;
float abstract calculate (float price)
{ dealer_com= 0.01*price +…
Declare an array that represents 100 students. Assign the examscores between 0 and 100 randomly into this array. Write amethod and display that assigns letter grade equivalents of theexam scores to a second array. Display the number ofunsuccessful students.The grade scala is as follows:100 – 90 : A89 – 80 : B79 – 70 : C69 – 60 : D59 – 0 : F (unsuccessful)
(Write in java)
Chapter 7 Solutions
Pearson eText for Starting out with Visual C# -- Instant Access (Pearson+)
Ch. 7.1 - Prob. 7.1CPCh. 7.1 - What is the difference in the way you work with...Ch. 7.1 - Prob. 7.3CPCh. 7.1 - Is a variable of the Random class a reference type...Ch. 7.2 - Prob. 7.5CPCh. 7.2 - Prob. 7.6CPCh. 7.2 - Prob. 7.7CPCh. 7.2 - Prob. 7.8CPCh. 7.2 - Prob. 7.9CPCh. 7.2 - Prob. 7.10CP
Ch. 7.4 - Prob. 7.11CPCh. 7.4 - Prob. 7.12CPCh. 7.4 - Prob. 7.13CPCh. 7.6 - Prob. 7.14CPCh. 7.6 - Prob. 7.15CPCh. 7.6 - Prob. 7.16CPCh. 7.7 - Prob. 7.17CPCh. 7.7 - Write a statement that assigns the value 50 to the...Ch. 7.7 - Prob. 7.19CPCh. 7.8 - Prob. 7.20CPCh. 7.8 - Write a statement that declares a jagged array of...Ch. 7.9 - Write a statement that initializes a List with 4...Ch. 7.9 - Prob. 7.23CPCh. 7.9 - Write a statement that clears the contents of the...Ch. 7.9 - Prob. 7.25CPCh. 7 - The memory that is allocated for a_______ variable...Ch. 7 - A variable that is used to reference an object is...Ch. 7 - When you want to work with an object, you use a...Ch. 7 - The_______ creates an object in memory and returns...Ch. 7 - A(n) is an object that can hold a group of values...Ch. 7 - The indicates the number of values that the array...Ch. 7 - Prob. 7MCCh. 7 - Prob. 8MCCh. 7 - When you create an array, you can optionally...Ch. 7 - Prob. 10MCCh. 7 - A(n)________ occurs when a loop iterates one time...Ch. 7 - C# provides a special loop that, in many...Ch. 7 - The foreach loop is designed to work with a...Ch. 7 - is a process that periodically runs, removing all...Ch. 7 - Various techniques known as_______ have been...Ch. 7 - Prob. 16MCCh. 7 - A(n) is a type of assignment operation that copies...Ch. 7 - Prob. 18MCCh. 7 - Prob. 19MCCh. 7 - The .NET Framework provides a class named_______,...Ch. 7 - When you are working with a value type, you are...Ch. 7 - Reference variables can be used only to reference...Ch. 7 - Individual variables are well suited for storing...Ch. 7 - Arrays are reference type objectsCh. 7 - Prob. 5TFCh. 7 - When you create a numeric array in C#, its...Ch. 7 - Prob. 7TFCh. 7 - You use the == operator to compare two array...Ch. 7 - Prob. 9TFCh. 7 - Prob. 10TFCh. 7 - How much memory is allocated by the compiler when...Ch. 7 - What type of variable is needed to work with an...Ch. 7 - What two steps are typically required for creating...Ch. 7 - Are variables well suited for processing lists of...Ch. 7 - Prob. 5SACh. 7 - Prob. 6SACh. 7 - Prob. 7SACh. 7 - Prob. 8SACh. 7 - Prob. 9SACh. 7 - Prob. 10SACh. 7 - Assume names is a variable that references an...Ch. 7 - Prob. 2AWCh. 7 - Write code for a sequential search that determines...Ch. 7 - Prob. 4AWCh. 7 - Prob. 5AWCh. 7 - Create a List object that uses the binary search...Ch. 7 - Total Sales In the Chap07 folder of the Student...Ch. 7 - Sales Analysis Modify the application that you...Ch. 7 - Charge Account Validation In the Chap07 folder of...Ch. 7 - Drivers License Exam The local drivers license...Ch. 7 - World Series Champions In the Chap07 folder of the...Ch. 7 - Name Search In the Chap07 folder of the Student...Ch. 7 - Population Data In the Chap07 folder of the...Ch. 7 - Tic-Tac-Toe Simulator Create an application that...Ch. 7 - Jagged Array of Exam Scores Dr. Hunter teaches...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Calculate the cutting time for a 4-in. length of cut, given that the feed rate is 0.030 ipr at a speed of 90 fp...
Degarmo's Materials And Processes In Manufacturing
This optional Google account security feature sends you a message with a code that you must enter, in addition ...
SURVEY OF OPERATING SYSTEMS
What is an object?
Starting Out With Visual Basic (8th Edition)
Test Scores and Grade Write a program that has variables to hold three test scores. The program should ask the ...
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Suppose a manufacturer produces a computer chip and later discovers a flaw in its design. Suppose further that ...
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
(Instance Variables) Explain the purpose of an instance variable.
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Arrays Write three statements to print the first three elements of array runTimes. Follow each statement with a newline. Ex: If runTime = {800, 775, 790, 805, 808}, print:800 775 790Note: These activities will test the code with different test values. This activity will perform two tests, both with a 5-element array (int runTimes[5]). See "How to Use zyBooks".Also note: If the submitted code tries to access an invalid array element, such as runTime[9] for a 5-element array, the test may generate strange results. Or the test may crash and report "Program end never reached", in which case the system doesn't print the test case that caused the reported message. #include <iostream>using namespace std; int main() {const int NUM_ELEMENTS = 5;int runTimes[NUM_ELEMENTS];int i; for (i = 0; i < NUM_ELEMENTS; ++i) {cin >> runTimes[i];} /* Your solution goes here */ return 0;} Please help me with this problem using c++.arrow_forwardWhich statement is correct?int[] n = { 16, 3, 7, 18, 21 };int[] m = n; Question 6 options: The variable m references a new array that is an exact of copy of n. Both n and m are variables that reference the same array. This is how you copy an existing array to a new one. The contents of n is copied to m.arrow_forwardI want this work be done in C# Visual studio. Given the following: private void btnRun_Click(object sender, EventArgs e){//Your code goes here } Code the statement(s) that will create a integer array of 5 elements and initialize the array with the following values in one line of code 10, 15, 20, 25, and 30. Then using a for loop alter the values in each element of the array by adding 5 to it. So after the for loop runs the values of the array should be 15, 20, 25, 30, and 35.arrow_forward
- Write code that will accept as input the characteristics of an undefined number of different softdrinks. Each softdrink should have a colour (of the can), name and volume. • Create SoftDrink objects and store them in an ArrayList (see the Appendix) as each softdrink is entered. • Alternatively, you can use an array. Take a number of items first, create an array of that size and read in the elements. • Prompt the user to add a softdrink until they choose to quit. • Once the user quits, print out a list of the softdrinks that the user has entered, sorted first by alphabetical order of name, then by colour, then by volume (ascending order). Name your driver class Question2.java. NOTE: • You can use the built-in static sort() method in the java.util.Collections class to sort your ArrayList of SoftDrink objects. Sample I/O Enter option: (1) add soft drink (2) quit: 1 Enter name, colour and volume in ml separated by space Fanta Orange 500 Enter option: (1) add soft drink (2)…arrow_forward1. Declare an array to save 4 Dog objects. The Dog class is provided below. Look into the Dog class and find what attributes are needed for a dog object. Then initialize five dogs with the following information: Lily, 5 years old Jacob, 2 years old Sugar, 8 years old Bush, 3 years old 2. Print out every dog using a for loop (use either regular for loop or for-each loop, your choice). But you may find when you print out, the name and age are not displayed. Why? 3. Fix this problem by implementing the toString method in the Dog class. Dog Class: public class Dog { private String name; private int age; public Dog(String name, int age) { this.name = name; this.age = age; } public void setName(String name) { this.name = name; } }arrow_forwardCreate an indexception value of unique consonants and unique vowels.This is the Input: String of the name that was given below. It must be case sensitive.Steps:Step A: In every unique vowel of a name, you need to get the first index of that vowel from the original string.Step B: In each vowel index you get from step A, you will get the unique consonant from that position. if the index is out of scope of the consonant array, ignore that vowel index.Step C: In each unique consonant that you get from step B, you need to get the first index of that consonant from the original string.Step D: You will the value of indexception by adding all index you get from step C.output must be like this: > 2 lists that consist of unique vowels and unique consonants> vowel, the vowel index, the consonant, the consonant indexfinal ouput> total indexception value of the name that was given. ------Input "Tricia O. Reyes"Output:Name: Tricia O. ReyesVowels: ['a', 'e', 'i', 'o']Consonants: ['T', 'r',…arrow_forward
- text file 80 1 2 3 100 100 100 1001 0 2 100 3 4 100 1002 2 0 4 4 100 5 1003 100 4 0 100 100 4 100100 3 4 100 0 3 3 3100 4 100 100 3 0 100 1100 100 5 4 3 100 0 2100 100 100 100 3 1 2 0 My code below. I am getting an error when trying to create my adjacency matrix. i dont know what i am doing wrong def readMatrix(inputfilename): ''' Returns a two-dimentional array created from the data in the given file. Pre: 'inputfilename' is the name of a text file whose first row contains the number of vertices in a graph and whose subsequent rows contain the rows of the adjacency matrix of the graph. ''' # Open the file f = open(inputfilename, 'r') # Read the number of vertices from the first line of the file n = int(f.readline().strip()) # Read the rest of the file stripping off the newline characters and splitting it into # a list of intger values rest = f.read().strip().split() # Create the adjacency matrix adjMat = []…arrow_forwardCreate a program that allows you to create a fantasy football roster based on the existing list of available players. Your team can only have 5 players, so create an array that can store 5 possible players. Prompt the user to pick 5 players to add to their team. If the player is available in the list of availablePlayers, then add that player to the users array, and remove that player from the availablePlayers list. Then prompt the user to pick another player. Once all five players have been added, then print the list in the console. Create a search method to find the index at which the player is located in the availablePlayers list so you can remove the player, and make sure that they are an eligible pick. Here is a sample run of the program: Enter Player you would like on your team: Cam Newton Great! That player is added to your team! Enter Player you would like on your team: Travis Kelce Great! That player is added to your team! Enter Player you would like on your team: Alvin Kamara…arrow_forwardJAVAWrite a program that calculates the average of math, science grades as well as total class average. The class gets the following math and science grade of mid-term: (image attached below) Your program should meet the following requirements: The program must declare a two-dimensional array to save all data above. Create two static methods - one is for calculating the total class average and the other is for calculating the average of math and science each. The program must use nested for loop to calculate math, and science average as well as the total class average. The program only allows two decimal places. (Example: 25.54)arrow_forward
- Write a hangman game that randomly generates a word and prompts the user to guess one letter at a time, as shown in the sample run. Each letter in the word is displayed in an asterisk. When the user makes a cor- rect guess, the actual letter is then displayed. When the user finishes a word, display the number of misses and ask the user whether to continue for another word. Declare an array to store words, as follows: // Use any words you wishstring words[] = {"write", "that", ...};arrow_forwardPls, explain how this program question applies to the code below and comment on it in the program. for example, comment the which part of the question applies to the code and how it worksarrow_forwardUsing the new operator, allocate an integer array of user specified size (the user gives the size of the array as input). Assign values to the array elements by taking user inputs and then print the values. Finally de-allocate the arrayusing the delete operator.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
9.1: What is an Array? - Processing Tutorial; Author: The Coding Train;https://www.youtube.com/watch?v=NptnmWvkbTw;License: Standard Youtube License