Introduction to Java Programming and Data Structures Comprehensive Version (11th Edition)
11th Edition
ISBN: 9780134700144
Author: Liang
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 2.8, Problem 2.8.1CP
Program Plan Intro
Naming conventions:
It is the set of rules used for choosing the character sequence of identifier name. The naming conventions denote variables, methods, classes, and constants.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
JAVA: Why is making all instance variables private considered a good programming technique?
How would you go about obtaining access to those variables?
JAVA: Why is it considered a good programming technique to make all instance variables private? How would you go about accessing those variables?
Problem Description and Given Info
For this assignment you are given the following Java source code files:
IStack.java (This file is complete – make no changes to this file)
MyStack.java (You must complete this file)
Main.java (You may use this file to write code to test your MyStack)
You must complete the public class named MyStack.java with fields and methods as defined below. Your MyStack.java will implement the IStack interface that is provided in the IStack.java file. You must implement your MyStack class as either a linked list or an array list (refer to your MyArrayList and MyLinkedList work). Your MyStack must not be arbitrarily limited to any fixed size at run-time.
UML
UML CLass Diagram: MyStack
Structure of the Fields
While there are no required fields for your MyStack class, you will need to decide what fields to implement. This decision will be largely based on your choice to implement this MyStack as either an array list or a linked list.
Structure of the Methods
As…
Chapter 2 Solutions
Introduction to Java Programming and Data Structures Comprehensive Version (11th Edition)
Ch. 2.2 - Identify and fix the errors in the following code:...Ch. 2.3 - How do you write a statement to let the user enter...Ch. 2.3 - Prob. 2.3.2CPCh. 2.4 - Prob. 2.4.1CPCh. 2.5 - Identify and fix the errors in the following code:...Ch. 2.6 - Identify and fix the errors in the following code:...Ch. 2.7 - Prob. 2.7.1CPCh. 2.8 - Prob. 2.8.1CPCh. 2.8 - Translate the following algorithm into Java code:...Ch. 2.9 - Prob. 2.9.1CP
Ch. 2.9 - Prob. 2.9.2CPCh. 2.9 - Prob. 2.9.3CPCh. 2.9 - Prob. 2.9.4CPCh. 2.9 - Prob. 2.9.5CPCh. 2.9 - Prob. 2.9.6CPCh. 2.9 - Write a statement to display the result of 23.5.Ch. 2.9 - Suppose m and r are integers. Write a Java...Ch. 2.10 - How many accurate digits are stored in a f1oat or...Ch. 2.10 - Prob. 2.10.2CPCh. 2.10 - Prob. 2.10.3CPCh. 2.10 - Which of the following are correct literals?...Ch. 2.11 - How would you write the following arithmetic...Ch. 2.12 - Prob. 2.12.1CPCh. 2.13 - Prob. 2.13.1CPCh. 2.14 - Which of these statements are true? a. Any...Ch. 2.14 - Show the output of the following code: int a = 6;...Ch. 2.15 - Prob. 2.15.1CPCh. 2.15 - Prob. 2.15.2CPCh. 2.15 - Show the following output: float f =12.5F; int i =...Ch. 2.15 - If you change (int) (tax 100) / 100.0 to (int)...Ch. 2.15 - Prob. 2.15.5CPCh. 2.15 - Write an expression that rounds up a double value...Ch. 2.16 - How would you write the following arithmetic...Ch. 2.17 - Show the output of Listing 2.10 with the input...Ch. 2.18 - Can you declare a variable as int and later...Ch. 2.18 - Prob. 2.18.2CPCh. 2.18 - Will overflow cause a runtime error?Ch. 2.18 - Prob. 2.18.4CPCh. 2 - (Convert Celsius to Fahrenheit) Write a program...Ch. 2 - (Compute the volume of a cylinder) Write a program...Ch. 2 - (Convert feet into meters) Write a program that...Ch. 2 - (Convert pounds into kilograms) Write a program...Ch. 2 - (Financial application: calculate tips) Write a...Ch. 2 - (Sum the digits in an integer) Write a program...Ch. 2 - (Find the number of years) Write a program that...Ch. 2 - (Current time) Listing 2.7. ShowCurrentTime.java,...Ch. 2 - (Physics: acceleration) Average acceleration is...Ch. 2 - (Science: calculating energy) Write a program that...Ch. 2 - (Population projection) Rewrite Programming...Ch. 2 - (Physics: finding runway length) Given an...Ch. 2 - (Financial application: compound value) Suppose...Ch. 2 - (Health application: computing BMI) Body Mass...Ch. 2 - (Geometry: distance of two points) Write a program...Ch. 2 - (Geometry: area of a hexagon) Write a program that...Ch. 2 - (Science: wind-chill temperature) How cold is it...Ch. 2 - (Print a table) Write a program that displays the...Ch. 2 - (Geometry: area of a triangle) Write a program...Ch. 2 - (Financial application: calculate interest) If you...Ch. 2 - (Financial application: calculate future...Ch. 2 - (Financial application: monetary units) Rewrite...Ch. 2 - (Cost of driving) Write a program that prompts the...
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
- Object-Oriented Programming ❤❤❤ Matchmaker with Java ❤❤❤ Summary: Create a Java application that will determine your true love. Prerequisites: Java, VS Code, and Terminal In this assignment you will develop and test a command-line application written in the Java language that asks questions to determine if a person is your true love. More specifically your application should ask five questions in the form of statements and allow the user to respond to each statement with the numbers 1 through 5 with 1 indicating strongly disagree and 5 indicating strongly agree. You will then compare the person’s answers with your desired “true love” answers. The closer the answers are to your desired “true love” answers the better match the two of you are for each other. For example, suppose you choose the statement “Broccoli is delicious.” and your desired answer was 1 (strongly disagree) because you really don’t like broccoli. If the application user entered 4 (agree), then the two of you would not…arrow_forwardObject-Oriented programming. need the full complete java code and comments for each line.arrow_forwardIn Java programming (Lesson: Objects, Classes, and Constructors) Every class has a constructor and if we do not explicitly write a constructor for a class, the java compiler builds a default constructor for that class. False or True Please provide an explanation for the answer. Thank you!arrow_forward
- java, please read the details for others had just copied from online. I am really grateful for the time your taking. Thank you Its javaarrow_forward7. Which of the following is NOT a type of variable in Java? None of the Choices Local Variables Class Variables Instance Variables Give an explanation for the answer. Thank youarrow_forwardMath 130 Java programming Code a Java project with two classes: Thank you!arrow_forward
- Question 19 How many objects can you create from a class in Java? 1 10 1000 As many as you needarrow_forwardQ1: Write a Java class called Machine which has: 2 instance variables brandName and power (to check if it is On or not) 2 constructors (a multi-argument constructor and a zero-argument one) getters for the two instance variables a setter for brandName 2 methods switchOn() and switchOff() which change the value of power a method called display() to print the status of the machineQ2: Write a Java class called TestMachines which has a main method to test yourcode as follows: create a Machine object to be initialized to "Dell" brand and to be Off. create another Machine object using the zero-arg constructor. Then change itsbrand to "Sharp" and switch it on. print the status of the 2 machines. declare and create an array that can hold up to 3 machines fill the array with suitable data print how many machines of brand "Dell" declare and create an ArrayList of machines fill the list with suitable data print how many machines are On.arrow_forwardPython Class and Objects Create a class named "Account" and “Bank” The class “Account” should have a parameter of id - integer type name - string type balance - float type # (Optional) You may add more parameters for your convenience 3. Create a method for “Account” class: checkBalance(self) - this will show the Account's remaining balance or money withdraw(self, amount) - this will withdraw an amount from the Account deposit(self, amount) - this will deposit an amount from the Account # (Optional) You may add more methods like sendMoney() etc. 4. Create a method for “Bank” class: addAccount(self, account) – used to register an account to the bank # (Optional) You may add more methods for your convenience 4. Create 3 Account objects with the following attributes in the main method account1 - id=(any number), name=(Any Name You Want), balance=7000 (strictly use this value) account2 - id=(any number), name=(Any Name You Want), balance= (any amount) account3 -…arrow_forward
- Write in Java and Include commentsarrow_forward25. Create a new Java program called Calculator.java. Create a new class and main method public static void main(String[] args) Now create three variables that stand for the two numbers that are calculated and the arithmetic symbol. In its first form, our calculator should only be able to calculate two numbers + or -. Think about which variable types you want to use. Create a variable as follows: type name = optional-seed; Using an if query, ask which arithmetic operation the calculator should use and then output the solution on the command line. Since using hard-coded values in source code isn't really appropriate for a user who doesn't want to constantly recompile the program, let's use the command-line parameters to specify the calculation to be performed. If you start your program as follows java Calculator <firstnumber> <arithmetic operation> <secondnumber> , <first number> and the other specified parameters are passed to the program. In your main method…arrow_forwardNEED HELP IN JAVA PROGRAMMING. "ENCAPSULATION" SHOULD BE IMPLEMENTED IN THE CODE. PLEASE FOLLOW INSTRUCTIONS AND REFER TO THE PICTURE BELOW FOR THE SAMPLE OUTPUT AND EXPLANATION. "ENCAPSULATION" Instructions 1. Create a program that will simulate a mango store. 2. First create the class Fruit see the representation of the class. 3. Second create the class FruitTester see the representation of the class. 4. You will not ask the user to enter the name, price and color of the fruit. Give them a static value using mutator methods. 5. Aside from the accessor and mutator, create a user defined method name calculatePrice( ) that will calculate the total price the user needs to pay. Formula (quantity * price). 6. Also create a user defined method name calculateChange( ) that will calculate the change of the user. Formula (cash - totalPrice). Note: You can create a validation that if the cash entered by the user is lower than the totalPrice. 7. When printing the values invoke the accessor…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT