Ask the user for an integer then ask the user if he/she wants to count up or down. Display a table of numbers where the first column contains the counter, the second column contains the counter plus 10, and the third column contains the counter plus 100. Make it so each number takes up 5 spaces total. If counting up, the first column should contain numbers 1 through the user input; If counting down, the first column should contain numbers -1 through the the negative of the user input; Do user input validation on the word "up" and "down". Allow for any case.
Implement your own version of the stack data structure using java with OOPs principles mentioned functionalities: push, pop, peek, contains, size, center, sort reverse, iterator, traverse/print.
Use of similar data structures already present in the language/framework is not allowed.
Implement the java code with data structure supporting listed functionalities using object-oriented principles
.Hash Table
Implement your own version of the linked list using java with mentioned functionalities: insert, insert at position, delete, delete at position, center, reverse, size, iterator, traverse/print.
Use of similar data structures already present in the language/framework is not allowed.
question: single entry
akshya is given a list of N integers. Each number in the list appears exactly for one number. help akshya by identifying the numbers which appeared exactly once in the list.
input:-
2 2 1
output:-
1
input:
8 9 2 8 9 2 5
output:
5
explanation:
in the example the given integers are 2 2 1 as the number 1 has appeared only once.
so the output should be 1.
Using a do while loop, write a program that will accept the name of the user and display “the user name” N number of times.
question:- string encoding
arya has two strings S and T consisting of lower case english letters.
since he loves encoding the strings, he dose the operation below just once on the string S
first, arya thinks of a non- negative integer K then he shifts each character of S to the right
by K
explanation:- 1) in the first example the given strings are S= abc and T= ijk.
when arya chooses K=8
"a" is shifted to the right by 8 and become "i"
"b" is shifted to the right by 8 and become "j"
"c" is shifted to the right by 8 and become "k"
2) in the second example, the given string are S=ppq and T=qqp
there is non-negative integer K that arya can choose to transform S into T so, No should be printed.
input: abc
ijk
output: Yes
input: ppq
qqp
output: No
Write a program in C++ that will simulate a basic calculator. The program should present a menu to the user and ask the user to type an option. You should use the switch statement to execute the operation selected. The menu should have the following options:
1. Add
2. Multiply
3.Subtract
4.Divide
The program should then ask for 2 numbers and perform the operation. For the 'Subtract' option, the program should check to see which number is greater then subtract the smaller number from the larger.
You are to write a program that will allow the user to select from a menu of 3 movies available to watch. The menu should look like the following:
If the user asks to watch Movie 1, ask for the number of tickets to buy and print the total to pay. The price per ticket for Movie 1 is $8.
If the user asks to watch Movie 2, then the program must ask for his/her age before it proceeds. If the user is younger than 18 years old, the program must print a message saying "Sorry you must be 18 or older to watch this movie." If the user is 18 or older, then proceed to ask how many tickets the user wants and print the total to pay. Price per ticket for Movie 2 is $10.
If the user asks to watch Movie 3, ask for the number of tickets to buy and print the total to pay. The price per ticket for Movie 3 is $6.50.
Suppose that score is an int variable. Consider the following if statements: if (score >= 90);
System.out.println("Discount = 10%");
a. What is the output if the value of score is 95? Justify your answer.
b. What is the output if the value of score is 85? Justify your answer.