Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me code the following in JAVA AssertDemo class: 1. Download the AssertDemo.java driver and run it 2. It should run with no problems,

Please help me code the following in JAVA

image text in transcribedimage text in transcribedimage text in transcribed AssertDemo class: image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

1. Download the AssertDemo.java driver and run it 2. It should run with no problems, but this is incorrect. We must enable asserts in our IDEs. If you compile using the command line, then use "java.exe-ea YourClass.java" For BlueJ: a. b. i. http://www.cs.uwlax.edu/riley/CS120F09/Handouts/7 assert in BlueJ.pdf c. For Eclipse: i. Click on "Run Configurations" in Eclipse. (a little arrow next to the play button) ii. Choose the current project (AssertDemo.java) from the list to the left iii. Choose the second tab "X-Arguments" iv. In the textarea labeled "VM arguments", add "-ea" 1. "ea" tells "java.exe" to "enable assertions" v. Click Ok or Apply and rerun AssertsDemo.java For any other editor (NetBeans, JGrasp, etc), simply Google the name of the editor and "how to enable asserts" for instructions. d. . Now with asserts enabled ("-ea"), your code should fail in the first two lines of asserts. 4. Look at and explain the first two asserts in main; which of the two is breaking the program? a. Comment out the offending assert line and rerun your code 5 In main, start by commenting out everything except what you're working on 6. Find the function warmUpAsserts() and look at the assert examples in the code a. At the end of this function, find the TODO and build two new assert code 7. Next, look at the function called assertWithPrimitives() and uncomment

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

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Sham Navathe

4th Edition

0321122267, 978-0321122261

More Books

Students also viewed these Databases questions