$20 Bonus + 25% OFF
Securing Higher Grades Costing Your Pocket?
Book Your Assignment at The Lowest Price
Now!
Students Who Viewed This Also Studied
SEC 290 Introduction to Programming with Python
Question:
- Study the Tableclass and write a JUnit test class TableTest.java to test the Table class as follows. Submit the test class and screen captures showing pass of all the tests. Either JUnit4 or JUnit 5 in any IDE may be used. (2 points)
- Create a table and put 10 entries of your choice (e.g., testTable.put(1, “testA”)).
- Test findIndex() for an non-existing entry.
- Test findIndex() for an existing entry.
- Test put() for an non-existing entry.
- Test put() for an existing entry
- Test put() for a new entry putting into the full table.
public class Table
{
private int manyItems;
private Object[] keys;
private Object[] data;
private boolean[] hasBeenUsed;
public Table(int capacity){
if (capacity
throw new IllegalArgumentException(“Capacity is negative”); keys=new Object[capacity];
data=new Object[capacity];
hasBeenUsed=new boolean[capacity];
}
public boolean containsKey(Object key){
return findIndex(key)!=-1;
}
public int findIndex(Object key){
int count=0;
int i=hash(key);
while (count
if (key.equals(keys[i]))
return i;
count++;
i=nextIndex(i);
}
return -1;
}
public Object get(Object key){
int index=findIndex(key);
if (index==-1)
return null;
else
return data[index];
}
private int hash(Object key){
return Math.abs(key.hashCode())%data.length;
}
private int nextIndex(int i){
if (i+1 == data.length)
return 0;
else
return i+1;
}
public Object put(Object key, Object element){
int index = findIndex(key);
Object answer;
if (index!=-1){ // The key is already in the table.
answer = data[index];
data[index] = element;
return answer;
}
else if (manyItems
index=hash(key);
while (keys[index]!=null)
index = nextIndex(index);
keys[index] = key;
data[index] = element;
hasBeenUsed[index] = true;
manyItems++;
return null;
}
else{ // The table is full.
throw new IllegalStateException(“Table is full.”);
}
}
public Object remove(Object key){
int index = findIndex(key);
Object answer = null;
if (index!=-1) // The key exists in the table.
{
answer=data[index];
keys[index]=null;
data[index]=null;
manyItems–;
}
return answer;
}
}
- Consider the Accountclass in the below. In the class, the withdraw() method audits when money is withdrawn. In order to test the withdraw() method, a stub should be provided for the
audit object. Implement the stub structure shown in the class diagram and test withdraw() method using the StubAudit class. Reference the stubbing example on slide 13-16 in Testing Strategies. (1 point)
- Study the following code and draw a control flow graph and measure the cyclomatic complexity based on the graph. The work must be shown. (2 point)
public static void main(String[] args)
{
final int NUMCHARS = 26;
Scanner scan = new Scanner(System.in);
int[] upper = new int[NUMCHARS];
int[] lower = new int[NUMCHARS];
char current; // the current character being processed
int other = 0; // counter for non-alphabetics
System.out.println(“Enter a sentence:”);
String line = scan.nextLine();
- Count the number of each letter occurence for (int ch = 0; ch
{
current = line.charAt(ch);
if (current >= ‘A’ && current
else
if (current >= ‘a’ && current
else other++;
}
- Print the results
System.out.println();
for (int letter=0; letter
{
System.out.print( (char) (letter + ‘A’) );
System.out.print(“: ” + upper[letter]);
System.out.print(“tt” + (char) (letter + ‘a’) );
System.out.println(“: ” + lower[letter]);
}
System.out.println();
System.out.println(“Non-alphabetic characters: ” + other);
}
- Based on the cyclomatic complexity measured in Question 3, identify the basis set of independent paths. (1 point)
- For each independent path in Question 4, write a test case in terms of input and output to exercise the path. (1.5 point)
- The following diagrams show a model for a pretty printing application. Refactor the class diagram and sequence diagram using the Visitor design pattern. Justify pros and cons of the refactored model (1.5 point).
SEC 290 Introduction to Programming with Python
Answer in Detail
Solved by qualified expert
Get Access to This Answer
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Hac habitasse platea dictumst vestibulum rhoncus est pellentesque. Amet dictum sit amet justo donec enim diam vulputate ut. Neque convallis a cras semper auctor neque vitae. Elit at imperdiet dui accumsan. Nisl condimentum id venenatis a condimentum vitae sapien pellentesque. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere. Et ultrices neque ornare aenean euismod. Suscipit tellus mauris a diam maecenas sed enim. Potenti nullam ac tortor vitae purus faucibus ornare. Morbi tristique senectus et netus et malesuada. Morbi tristique senectus et netus et malesuada. Tellus pellentesque eu tincidunt tortor aliquam. Sit amet purus gravida quis blandit. Nec feugiat in fermentum posuere urna. Vel orci porta non pulvinar neque laoreet suspendisse interdum. Ultricies tristique nulla aliquet enim tortor at auctor urna. Orci sagittis eu volutpat odio facilisis mauris sit amet.
Tellus molestie nunc non blandit massa enim nec dui. Tellus molestie nunc non blandit massa enim nec dui. Ac tortor vitae purus faucibus ornare suspendisse sed nisi. Pharetra et ultrices neque ornare aenean euismod. Pretium viverra suspendisse potenti nullam ac tortor vitae. Morbi quis commodo odio aenean sed. At consectetur lorem donec massa sapien faucibus et. Nisi quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Duis at tellus at urna condimentum mattis pellentesque. Vivamus at augue eget arcu dictum varius duis at. Justo donec enim diam vulputate ut. Blandit libero volutpat sed cras ornare arcu. Ac felis donec et odio pellentesque diam volutpat commodo. Convallis a cras semper auctor neque. Tempus iaculis urna id volutpat lacus. Tortor consequat id porta nibh.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Hac habitasse platea dictumst vestibulum rhoncus est pellentesque. Amet dictum sit amet justo donec enim diam vulputate ut. Neque convallis a cras semper auctor neque vitae. Elit at imperdiet dui accumsan. Nisl condimentum id venenatis a condimentum vitae sapien pellentesque. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere. Et ultrices neque ornare aenean euismod. Suscipit tellus mauris a diam maecenas sed enim. Potenti nullam ac tortor vitae purus faucibus ornare. Morbi tristique senectus et netus et malesuada. Morbi tristique senectus et netus et malesuada. Tellus pellentesque eu tincidunt tortor aliquam. Sit amet purus gravida quis blandit. Nec feugiat in fermentum posuere urna. Vel orci porta non pulvinar neque laoreet suspendisse interdum. Ultricies tristique nulla aliquet enim tortor at auctor urna. Orci sagittis eu volutpat odio facilisis mauris sit amet.
Tellus molestie nunc non blandit massa enim nec dui. Tellus molestie nunc non blandit massa enim nec dui. Ac tortor vitae purus faucibus ornare suspendisse sed nisi. Pharetra et ultrices neque ornare aenean euismod. Pretium viverra suspendisse potenti nullam ac tortor vitae. Morbi quis commodo odio aenean sed. At consectetur lorem donec massa sapien faucibus et. Nisi quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Duis at tellus at urna condimentum mattis pellentesque. Vivamus at augue eget arcu dictum varius duis at. Justo donec enim diam vulputate ut. Blandit libero volutpat sed cras ornare arcu. Ac felis donec et odio pellentesque diam volutpat commodo. Convallis a cras semper auctor neque. Tempus iaculis urna id volutpat lacus. Tortor consequat id porta nibh.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Hac habitasse platea dictumst vestibulum rhoncus est pellentesque. Amet dictum sit amet justo donec enim diam vulputate ut. Neque convallis a cras semper auctor neque vitae. Elit at imperdiet dui accumsan. Nisl condimentum id venenatis a condimentum vitae sapien pellentesque. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere. Et ultrices neque ornare aenean euismod. Suscipit tellus mauris a diam maecenas sed enim. Potenti nullam ac tortor vitae purus faucibus ornare. Morbi tristique senectus et netus et malesuada. Morbi tristique senectus et netus et malesuada. Tellus pellentesque eu tincidunt tortor aliquam. Sit amet purus gravida quis blandit. Nec feugiat in fermentum posuere urna. Vel orci porta non pulvinar neque laoreet suspendisse interdum. Ultricies tristique nulla aliquet enim tortor at auctor urna. Orci sagittis eu volutpat odio facilisis mauris sit amet.
Tellus molestie nunc non blandit massa enim nec dui. Tellus molestie nunc non blandit massa enim nec dui. Ac tortor vitae purus faucibus ornare suspendisse sed nisi. Pharetra et ultrices neque ornare aenean euismod. Pretium viverra suspendisse potenti nullam ac tortor vitae. Morbi quis commodo odio aenean sed. At consectetur lorem donec massa sapien faucibus et. Nisi quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Duis at tellus at urna condimentum mattis pellentesque. Vivamus at augue eget arcu dictum varius duis at. Justo donec enim diam vulputate ut. Blandit libero volutpat sed cras ornare arcu. Ac felis donec et odio pellentesque diam volutpat commodo. Convallis a cras semper auctor neque. Tempus iaculis urna id volutpat lacus. Tortor consequat id porta nibh.
37 More Pages to Come in This Document. Get access to the complete answer.
Missing of deadlines is a myth with MyAssignmenthelp.com. Our super-fast writers take minimum time to complete your assignment orders without compromising the quality. We welcome unlimited revisions. We boost the presence of 3000+ subject matter experts excellent in crafting customized essays, assignments and dissertations. Team MyAssignment.com not only rule in Australia, UK and US but has also spread its wings to Canada, Singapore and UAE. We operate 24 hours a day considering the hectic academic schedule of scholars. MyAssignmenthelp.com is a reliable source where the written assignments are processed through series of quality check to guarantee 100 percent original papers. Get your custom essay help, dissertation writing services and online assignment help at the unbeatable price in the industry.
More SEC290 SEC 290 Introduction to Programming with Python: Questions & Answers
Business Management
Implement class RandomInt using randomInt.cpp and randomInt.h. For the RandomInt class:• The function call operator is overloaded and will generate a random number each time the operator is used.• Objects can be created with the lower and upper bound of …
View Answer
Management
OriginalFlyingHobbyWeb.zip file has been given by my lecturer(also Coordinator) in the class for me and only the other student in my campus to pass this subject easily.(especially for Prac1) You can use html files. When we assume that Main.html is Level 1, you need to make Level 2, Level 3 only. you …
View Answer
Information System
For the Final Project Part I: Milestone One you will use the Student Information System Requirements Definitions document and the Final Project Part I Solution Submission Template document to complete the milestone activity. Refer to instructor and peer feedback in the discussion forum from the prev …
View Answer
Information Technology
Ques1: Write a program to process student marks scored in this subject. Create two array variables one to store student ids and another one to store marks scored by students. For simplicity, you can keep ids as numbers only so declare it as integer and marks as a double array. Then create a menu wit …
View Answer
Content Removal Request
If you are the original writer of this content and no longer wish to have your work published on Myassignmenthelp.com then please raise the
content removal request.
Choose Our Best Expert to Help You
Burgess Carlson
I received my Masters in Computer Science from the University of Southampton.
260 – Completed Orders
Hire Me
Still in Two Minds? The Proof is in Numbers!
33845 Genuine Reviews With a Rating of 4.9/5.
Assignment
Home Work: 3 Pages, Deadline:
7 days
Thanks to your efforts and reaching out before the due date. Your works are well written and well organized.
User ID: 6***55 Canada
Business Law
Case Study: 4 Pages, Deadline:
25 days
Good job, I am happy with the amazing services and completed work given. Thank you very much for helping me receive a good mark. Will definitely work …
User ID: 2***91 Kuala Lumpur, Malaysia
Management
Assignment: 14 Pages, Deadline:
9 days
Satisfied with the work and expert delivered a good output and looking forward to get help with my assignments in future
User ID: 7***64 United Kingdom, Great Britain
Management
Essay: 6.8 Pages, Deadline:
2 days
The writer did an amazing job I am happy with it delivered it on time hoping to getting more done from them in the future
User ID: 3***40 United Kingdom, India
Accounting
Assignment: 1.6 Pages, Deadline:
3 days
Good assignment was satisfied with the assignment hoping for receiving good assignment in future
User ID: 6***55 United Kingdom, Oman
Management
Essay: 8 Pages, Deadline:
3 days
I am so satisfied with the level of your work, good timing finally Many thanks for the good work ,
User ID: 8***63 Manchester, Great Britain
Marketing
Home Work: 1 Page, Deadline:
1 day
Glad you tied some of the sociological, political and psychological factors into your analysis
User ID: 6***98 Manchester, United States
Electronics
Assignment: 8 Pages, Deadline:
1 day
Amazing work! It really helped me understand the assignment. Thank you again a real life saver.
User ID: 5***73 United Kingdom, Great Britain
Physics
Programming: 0.6 Pages, Deadline:
3 days
It wasn’t all correct but the majority of the work was really good and helpful! Would recommned.
User ID: 5***73 United Kingdom, Great Britain
Management
Assignment: 5 Pages, Deadline:
1 day
good work i really want to thank you about what you did in the assignment and i hope to work with you again
User ID: 8***48 United Kingdom, Saudi Arabia
Management
Assignment: 6 Pages, Deadline:
13 days
i really satisfied and thank you about what you did its great work and i happy to work with you again
User ID: 8***48 United Kingdom, Saudi Arabia
Management
Assignment: 8 Pages, Deadline:
15 days
well structured, goodknowledge and delivered on time with the best references, I hope we collaborate in the future more
User ID: 3***64 Birmingham, Great Britain
Project Management
Assignment: 6.4 Pages, Deadline:
12 days
I am satisfied with the marks, both assignment 1 and 2 are done well. Thank you. The work whick was done was good
User ID: 8***95 United Kingdom, Great Britain
Economics
Assignment: 28 Pages, Deadline:
6 days
Thanks for all the effort, the only concern or question is, how would be possible to do any revision in future if needed?
User ID: 8***91 United Kingdom, Canada
Civil Law
Assignment: 0 Pages, Deadline:
20 days
The presentation is well executed generally. The style (delivery) could be more engaging with the listening audience. The slides are good – concise an …
User ID: 3***07 Cork, Ireland
Electronics
Home Work: 6 Pages, Deadline:
9 hours
Awesome Stuff! They provided really useful feedback and helped me understand the assignment very well.
User ID: 5***73 United Kingdom, Great Britain
Audit
Assignment: 14 Pages, Deadline:
13 days
The assignment has not been scored yet but thank you for the corrections and time.
User ID: 8***91 United Kingdom, Great Britain
Management
Assignment: 12 Pages, Deadline:
2 days
I have been quite a good experience with your service. I got 70/100 grade on my result. However, the most important things that you can do are more cr …
User ID: 8***43 United Kingdom, Singapore
Nursing
Assignment: 5 Pages, Deadline:
16 days
This was my last assignment for concepts and theories class and when I tell you using this site helped while I was in school and in between classes.
User ID: 6***42 United Kingdom, United States
Healthcare
Essay: 6 Pages, Deadline:
12 days
Received a good grade for this particular assignment. It was on time and informative with the topic provided. Thank you.
User ID: 6***42 United Kingdom, United States
Assignment
Home Work: 3 Pages, Deadline:
7 days
Thanks to your efforts and reaching out before the due date. Your works are well written and well organized.
User ID: 6***55 Canada
Business Law
Case Study: 4 Pages, Deadline:
25 days
Good job, I am happy with the amazing services and completed work given. Thank you very much for helping me receive a good mark. Will definitely work …
User ID: 2***91 Kuala Lumpur, Malaysia
Management
Assignment: 14 Pages, Deadline:
9 days
Satisfied with the work and expert delivered a good output and looking forward to get help with my assignments in future
User ID: 7***64 United Kingdom, Great Britain
Management
Essay: 6.8 Pages, Deadline:
2 days
The writer did an amazing job I am happy with it delivered it on time hoping to getting more done from them in the future
User ID: 3***40 United Kingdom, India
Accounting
Assignment: 1.6 Pages, Deadline:
3 days
Good assignment was satisfied with the assignment hoping for receiving good assignment in future
User ID: 6***55 United Kingdom, Oman
Management
Essay: 8 Pages, Deadline:
3 days
I am so satisfied with the level of your work, good timing finally Many thanks for the good work ,
User ID: 8***63 Manchester, Great Britain
Marketing
Home Work: 1 Page, Deadline:
1 day
Glad you tied some of the sociological, political and psychological factors into your analysis
User ID: 6***98 Manchester, United States
Electronics
Assignment: 8 Pages, Deadline:
1 day
Amazing work! It really helped me understand the assignment. Thank you again a real life saver.
User ID: 5***73 United Kingdom, Great Britain
Physics
Programming: 0.6 Pages, Deadline:
3 days
It wasn’t all correct but the majority of the work was really good and helpful! Would recommned.
User ID: 5***73 United Kingdom, Great Britain
Management
Assignment: 5 Pages, Deadline:
1 day
good work i really want to thank you about what you did in the assignment and i hope to work with you again
User ID: 8***48 United Kingdom, Saudi Arabia
Management
Assignment: 6 Pages, Deadline:
13 days
i really satisfied and thank you about what you did its great work and i happy to work with you again
User ID: 8***48 United Kingdom, Saudi Arabia
Management
Assignment: 8 Pages, Deadline:
15 days
well structured, goodknowledge and delivered on time with the best references, I hope we collaborate in the future more
User ID: 3***64 Birmingham, Great Britain
Project Management
Assignment: 6.4 Pages, Deadline:
12 days
I am satisfied with the marks, both assignment 1 and 2 are done well. Thank you. The work whick was done was good
User ID: 8***95 United Kingdom, Great Britain
Economics
Assignment: 28 Pages, Deadline:
6 days
Thanks for all the effort, the only concern or question is, how would be possible to do any revision in future if needed?
User ID: 8***91 United Kingdom, Canada
Civil Law
Assignment: 0 Pages, Deadline:
20 days
The presentation is well executed generally. The style (delivery) could be more engaging with the listening audience. The slides are good – concise an …
User ID: 3***07 Cork, Ireland
Electronics
Home Work: 6 Pages, Deadline:
9 hours
Awesome Stuff! They provided really useful feedback and helped me understand the assignment very well.
User ID: 5***73 United Kingdom, Great Britain
Audit
Assignment: 14 Pages, Deadline:
13 days
The assignment has not been scored yet but thank you for the corrections and time.
User ID: 8***91 United Kingdom, Great Britain
Management
Assignment: 12 Pages, Deadline:
2 days
I have been quite a good experience with your service. I got 70/100 grade on my result. However, the most important things that you can do are more cr …
User ID: 8***43 United Kingdom, Singapore
Nursing
Assignment: 5 Pages, Deadline:
16 days
This was my last assignment for concepts and theories class and when I tell you using this site helped while I was in school and in between classes.
User ID: 6***42 United Kingdom, United States
Healthcare
Essay: 6 Pages, Deadline:
12 days
Received a good grade for this particular assignment. It was on time and informative with the topic provided. Thank you.
User ID: 6***42 United Kingdom, United States
Have any Query?
The post SEC 290 Intro to Programming with Python: Cyclomatic Complexity appeared first on study tools.