Questions: 1 362

Answers by our Experts: 1 362

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

WRAV101: Practical 4

Submit in Moodle before Tuesday 22 March, 14:00

Objectives

 Using loops

 Using decision statements

 Using build-in methods

NB: Check out the steps below regarding getting started, saving the program (after


Task 3

Write a program to display the squares of all the numbers 1 to 100 in a

table format similar to the output displayed.

You have to make use of a loop.


create a program, name it PRGYOURNAMEFA1, that implements a search and replace function recursively. Your program should allow a user to enter a string , a substring to be replaced in the entered string and a character/s to replace the found substring 

Program Structure

1. A main class that implements the logic of the program – name this class TestSearchReplace

2. Add a class named SearchReplace to the main class with two methods, including:

a. SearchSubstring()- return method

b. ReplaceSubString() - void method

The two method should be called using an object in the main class. DONT CREATE THE TWO METHODS IN THE MAIN CLASS

Sample Output:

1 Please enter a string: Hello world

2 Please enter the substring you wish to find: llo

3 Please enter a string to replace the given substring:@@

4 Your new string is: h@@ world

Write a program that requests the user for 20 numbers and calculates the average of the numbers which are smaller than 10. You have to make use of a loop.


Write a program to display the squares of all the numbers 1 to 100 in a table format similar to the output displayed. You have to make use of a loop. (Note: the output shown here is only an extract of the output your program should give)


Write a program to display the numbers 8 down to 0 underneath one another, making use of a loop


Write a program to display the numbers 1 to 14 next to one another (but with spaces in between), making use of a loop


Using visual studio (C#) to create a program, name it PRGYOURNAMEFA1, that implements a search and replace function recursively. Your program should allow a user to enter a string , a substring to be replaced in the entered string and a character/s to replace the found substring 

Program Structure

1. A main class that implements the logic of the program – name this class TestSearchReplace

2. Add a class named SearchReplace to the main class with two methods, including:

a. SearchSubstring()- return method

b. ReplaceSubString() - void method

The two method should be called using an object in the main class. DONT CREATE THE TWO METHODS IN THE MAIN CLASS

Create a Date class with integer data members for year, month, and day. Also, include a string data member for the name of the month. Include a method that returns the month name (as a string) as part of the date. Separate the day from the year with a comma in that method. Include appropriate methods. Create the To_String() method to display the date formatted with slashes () separating the month, day, and year. Create a second class that 

  instantiates and test the Date class. Make UML Diagram Also



Create a Date class with integer data members for year, month, and day. Also, include a string data member for the name of the month. Include a method that returns the month name (as a string) as part of the date. Separate the day from the year with a comma in that method. Include appropriate methods. Create the To_String() method to display the date formatted with slashes () separating the month, day, and year. Create a second class that 

    /instantiates and test the Date class. Make UML Diagram Also


Write a class marks with three data members to store three marks. Write three member functions, set_marks() to input marks, sum() to calculate and return the sum and avg() to calculate and return average marks.


LATEST TUTORIALS
APPROVED BY CLIENTS