Given a string, write a program to mirror the characters of the string in alphabetical order to create a secret message.
Note: Mirroring the characters in alphabetical order replacing the letters 'a' with 'z', 'b' with 'y', ... , 'z' with 'a'. You need to mirror both uppercase and lowercase characters. You can ignore mirroring for all characters that are not letters.
abcdefghijklmzyxwvutsrqpon nopqrstuvwxyzmlkjihgfedcba
import java.util.EmptyStackException;
public class IntStackTest implements IntStack{ private int top = -1;
private int[] data;
private static final int DEFAULT_CAPACITY = 10;
public IntStackTest() {
data = new int[DEFAULT_CAPACITY];
}
public void push(int item) {
if (top == data.length - 1) resize(2*data.length);
data[++top] = item; }
public int pop() {
//if (isEmpty()) throw new EmptyStackException();
return data[top--]; }
private void resize(int newCapacity) { int[] newData = new int[newCapacity]; for (int i = 0; i <= top; i++) {
newData[i] = data[i]; }
data = newData; }
public static void main(String[] args) { int x;
IntStack s = new IntStackTest(); s.push(7);
s.push(4);
s.push(18);
4
x = s.pop(); System.out.println("pop() ---> " + x ); x = s.pop(); System.out.println("pop() ---> " + x ); x = s.pop(); System.out.println("pop() ---> " + x );
} }
A. Provide a graphical representation of the Stack when the above code is run
You Just got your 1st internship as C++ developer CONGRATULATIONS, your manager gives you your 1st task to solve below.PROBLEM SPECIFICATION
Your company wants to collect the total number of age groups within the company and calculate the average age of employees and the classification (see below table) within the company. You are required to write a program in C++ that will ask the user to enter the integer age. Determine in which group allocation each employee belong (refer to table below) and calculate the total Age sum and the company average age. The program should populate areport showing all the information The user should enter a negative value to indicate that they are done Description Young employees Age group From 19 till 35 Middle Age group Elderly 36 till 49 (inclusive) 50 till 65
Write a program that swaps values between different locations in a two dimensional array. Make sure that the locations between which the values are being exchanged are symmetric.
Write a program that uses a two dimensional of 256 x 8 to store 8 bit binary representations of each of the characters of ASCII character set
Write a function that accepts three arguments a number n, and two characters s and t. The function convert n from s unit to t unit of similar physical quantities. You can choose one of the following types to use in your program:
1. Length
2. Temperature
3. Area
4. Volume
5. Weight
6. Time
Model a room class, whose member data is three integers length, width and height. The class contains two constructors to initialize the room class objects, first is no argument constructor, while the second in three arguments constructor. Class also contains three member functions i.e., getdatat() to get the data from user and store in the memory of calling object and showdata() to show the room data of calling object. int volume(int l, int w, int h) function should receive the length, width and height values from the objects one by one and return the volumes of the three objects respectively. Write a main program to declare the three object r1, r2, and r3 of room class. Two object will store the values through three argument constructor and third object will get the data from user by calling getdata() function. Then all three objects should call the volume functions to calculate their volumes and store them in three variables of type integer.
Implement a Heap ADT using vector.
In main function, declare an array of N (10 < N < 30) elements and fill it with random numbers between 1 and 100. Then fill heap with these number and then remove all items by displaying them on screen (heap sort demonstration).
Write a function that accepts a character ch and a number n as arguments. The function then displays an n x n grid filled with ch. Use the function in a program.
For the periods 2014 to 2019, ESKOM’s electricity percentage price adjustments are given in the
following table:
2014/15 2015/16 2016/17 2017/18 2018/19
7.05% 31.70% 8.18% 1.62% 2.82%
Table 1: Average percentage price adjustments
a) Find the Average (arithmetic mean) percentage price adjustment from
2014 to 2019 (5