Earn Higher Grades With Instant Assignment Help.Ask Question!

Java Programming
(5/5)

You must rotate a square matrix counter-clockwise or clockwise 90 degrees an arbitrary number of times. You will be given a matrix of integers that has equal height and width.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Rotate Matrix

You must rotate a square matrix counter-clockwise or clockwise 90 degrees an arbitrary number of times. You will be given a matrix of integers (otherwise known as a 2-dimensional array), that has equal height and width. The dimension can range from 2x2 - 10x10. You will also be given an integer that may range from -100 to 100, this integer will indicate which direction to rotate the matrix and how many times to rotate it. You are expected to return the rotated matrix.

direction - The number of rotations in a particular direction. If > 0 rotate the specified amount of times clockwise. else if < 0 rotate the specified amount of times counterclockwise. Otherwise, no rotations are expected.

matrix - A two-dimensional array of integers that is to be rotated.

returns -  The rotated matrix it was initially given.

int[][] rotateMatix(int direction, int[][] matrix)

 

Remove Nested Statements

When given a string, your job is to remove a substring that starts with a prefix and ends with a suffix pattern. The patterns may be nested within each other so you must remove the outer most pattern's found in the text. The length of the prefix and suffix will always match.

 

Example:

prefix = "{" suffix = "}" text ="{Hello} Bob"

expected output = " Bob"

prefix = "{" suffix = "}" text ="He{ll}o} Bob"

expected output = "Heo} Bob"

prefix = "{" suffix = "}" text ="H{e{ll}o} Bob"

expected output = "H Bob"

text - The string with the substring to be removed

prefix - A pattern that the substring must start with

suffix -  A pattern that the substring must end with

returns -  The given text with the substring removed

String removeNestedStatements(String text, String prefix, String suffix)

Count Occurrences

Count the number of times a given pattern is found in the string in the array of strings.

Example:

array = ["aba", "ckel",  "kealska"]

pattern = "a"

output = 4

array - An array of strings

pattern - A pattern you are attempting to find in the strings contained in the array

returns - The number of times the pattern is found in the strings in the array.

int countOccurances(String[] array, String pattern)

Merger and Remove

Given two arrays of integers. Your job is to combine them into a single array and remove any duplicates, finally return the merged array.

Example:

array_1 = [1,2,3]

array_2 = [2,3,4]

output = [1,2,3,4]

array_1 - An array of integers

array_2 - An array of integers

returns - An array of integers containing the unique values from both array_1 and array_2

int[] mergeAndRemove(int[] array_1, int[] array_2)

Morse Translator

You will be given a string in either morse code or normal English text. Your job is to translate the string to the opposite language. In other words, if the string you are given is English translate the string to morse code. Furthermore, if the string is morse code translate the string into English. To keep things simple, any English text you receive will not contain any "." or "-". Please refer to this link to find the character translations.

Example:

input = "Hello"

output = ".... . .-.. .-.. ---"

input = ".... . .-.. .-.. ---"

output = "Hello"

input - A string that may be either morse code or plain English.

returns - The input converted into the opposite language of its initial format.

String morseTranslator(String text)

Attachments:
(5/5)

Related Questions

CSI 1420 Introduction to C Programming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two majorconstructs of the C programming language – Fu

The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Assignment To Be Done By Our ExpertsGet A+ Grade Solution Guaranteed

expert
joyComputer science
(4/5)
12 Answers Hire Me
expert
Robert DLaw
(4.8/5)
643 Answers Hire Me
expert
Dr Samuel BarberaStatistics
(5/5)
622 Answers Hire Me
expert
Tutor For YouEconomics
(5/5)
865 Answers Hire Me