C++ PROGRAM (Pointers and char arrays)
IMPORTANT NOTES:
1. CHAR ARRAY MUST BE USED.
2. YOU MUST USE POINTERS.
3. YOU MUST USE THE SWITCH STATEMENT TO EXECUTE THE PROGRAM.
4. ALL MODIFICATIONS MUST BE DONE IN THE SAME ORIGINAL CHAR ARRAY WITHOUT CREATING A NEW ONE.
Write a C++ program that modifies a null teminated char array as follows:
Consonants are positioned at the beginning of the string and vowels are moved to the end of the string.
Example :
Original string : density
New string : dnstyei
In: Computer Science
Question: Can you please convert this program into switch case program using c++.
Output should be same
int main()
{
bool weekend = false;
unsigned char day = 0;
bool isDay = true;
cout << " Enter a char for a day of week:";
cin >> day ;
if (day == 'M' || day == 'm')
cout << " This is Monday" << endl ;
else if (day == 'T' || day == 't')
cout << " This is Tuesday" << endl ;
else if (day == 'W' || day == 'w')
cout << " This is Wednesday" << endl ;
else if (day == 'R' || day == 'r')
cout << " This is Thursday" << endl ;
else if (day == 'F' || day == 'f')
cout << " This is Friday" << endl ;
else if (day == 'S' || day == 's')
{
cout << " This is Saturday" << endl ;
weekend = true ;
}
else if (day == 'U' || day == 'u')
{
cout << " This is Sunday " << endl ;
weekend = true ;
}
else
{
cout << day << " is not recognized..." << endl ;
isDay = false;
In: Computer Science
IN JAVA Create a program that uses a nested for loop to display a rectangle of #'s with a given number of rows and columns,. This should only display the # when the column is an odd number (see examples below).
Get the number of rows and columns from the user, and display the result.
Examples:
If the user provided rows=4, and columns=7, the program should display a pattern as follows:
# # # #
# # #
# # # #
# # #
If the user provide rows=2, and columns=5, the program should display a pattern as follows:
# # #
# #
etc.
Upload
In: Computer Science
What is the final value of variable x?
x = 0
msg = "hello there!"
for character in msg:
if character=="e":
x += 1In: Computer Science
What is the last value of variable x?
y = 0
x = 0
while y<=10:
if y%2==0:
x = x + 2
y += 1In: Computer Science
Python 3:
Create functions to draw each of these with sides of
size side:triangle, square, pentagon, hexagon
The function should be the shape + "2d"
Use import turtle and the turtle commands: forward(), left(),
right(), pendown(), penup(), done(), color()
Use the goto(X,Y) function to allow the shape to be drawn at a
specific location
Use the x,y, and side attributes for screen position and
size
In: Computer Science
Briefly Describe three potential concerns that buyers of these smart connected products might have about this trend to smart, connected products.
In: Computer Science
****** please don't copy and paste and don't use handwriting
****** I need a unique answer
Q1: Write HTML code to get the following output that include the following elements.
The title is: Favorite Books
Large heading with text “Your Favorite Books”
Form that has 3 input values (two text boxes and one drop down list)
Drop-down list contains the following options,
Wiley
Mc-Graw Hill
Submit information to “books.php” using GET request.
Q2:Display a simple message "Welcome" on your demo webpage. When the user hovers over the message, a popup should be displayed with a message "Welcome to our new WebPage!!!".
Q3:
Create XHTML and CSS file to show your information. Style the table to match the on in the picture. You are allowed to choose your preferred colors; however, you cannot change the style of the table.
The table must be centered in the page
Heading font is Times New Roman
Text in table cells must be centered
In: Computer Science
Write a script that represents a simple command line calculator. It will accept two numbers from command line, and then display sum, difference and product of these two numbers. Provide script code and screenshot of output.
Using Linux Ubuntu bash
In: Computer Science
In this assignment, you will study databases and differentiate between the various database models and tools available to design databases.
Specify at least two real-life situations where you have seen a database in use and based on your observations, answer the following questions:
Pick one of the database models and list at least two situations in which the model can be applied. You can choose to find the model used in the database that you find in your real-life situation and then answer.
Further, research the Internet for features of the tools that can help you create a database design. You can confine your search to:
Based on your research, would you recommend any of these tools for database design based on the information available on the Internet? Why or why not? You may discuss other tools in addition to these.
In: Computer Science
I NEED THIS IN PSEUDOCODE:
SWITCH/CASE 2 - Complete the pseudocode below by including a SWITCH statement that takes the user input (an integer between 26-30) and prints out a count up in its English equivalent. For example: if the user inputs “26”, the code will print “twenty-six”, “twenty-seven” on the next line, and so on up to “thirty”. If the user inputs “30”, the code will print “thirty” and finish.
CREATE inputNum
PRINT ("Please enter a number between 26-30 to start counting from:")
READ inputNum
WHILE inputNum >= 26 AND inputNum <= 30
BEGIN WHILE
In: Computer Science
IN C++
Implement in C++ a game called “Your Lucky Number”. The lucky number is calculated based on an individual’s birth month, day, and year. The algorithm assigns any person a number between 1 and 9. Many people believe that a group of people with the same lucky number share common features. The lucky number is calculated as the sum of digits of the birth month, day, and year numbers. If this sum is not a single-digit then you need to keep adding up its digits. Use the C++ functions when you implement the game. Test your program for corrections. To start the game you should enter your full birthdate in the format: month day year, e.g. 9 21 1985. The month is represented by its corresponding integer: January is 1, February is 2, ..., and December is 12. Be sure that your program will verify the input format and print an error message when the format is incorrect (use exceptions), and will ask to re-enter the birthdate again. The algorithm for calculating the lucky number
(a) Enter the month as an integer from 1 to 12.
(b) Reduce the month, day and year numbers down to a one-digit number by adding all digits in the month, day and year numbers, see the example below.
(c) Map the number to the category listed below and display the message on the screen with at least four features for a person in each category. I provided only one feature (as an adjective) for each category and you should complete the list.
(d) Test your program using at least 10 your friends’ or relatives’ birthdays.
Categories:
1. The Leader: original thinker (add 3 more features)
2. The Mediator: diplomatic (add 3 more features)
3. The Communicator: expressive (add 3 more features)
4. The Teacher: trustworthy (add 3 more features)
5. The Freedom Seeker: adventurous (add 3 more features)
6. The Nurturer: family-oriented (add 3 more features)
7. The Seeker: analytic (add 3 more features)
8. The Power House: authoritative (add 3 more features) 9. The Humanitarian: charitable (add 3 more features)
In: Computer Science
Assess the six stages of BI application development and evaluate the primary activity of each.
In: Computer Science
Must be written in JAVA Code
Modify the program you created in previous project to accomplish the following:
Support the storing of additional user information: street address (string), city( string), state (string), and 10-digit phone number (long integer, contains area code and does not include special characters such as '(', ')', or '-'
Store the data in an ArrayList object
Program to Modify
import java.util.ArrayList;
import java.util.Scanner;
public class Address
{
String firstname;
String lastname;
int zipcode;
Address(String firstname,String lastname,int zipcode)
{
this.firstname = firstname;
this.lastname = lastname;
this.zipcode = zipcode;
}
public String toString()
{
return this.firstname + " " + this.lastname + " " +
this.zipcode;
}
public static void main(String[] args)
{
Scanner aa = new Scanner(System.in);
int n;
System.out.print("Enter a number up to 25: ");
n = aa.nextInt();
String firstname,lastname;
int zipcode;
ArrayList<Address> addr = new
ArrayList<Address>();
aa.nextLine();
for(int i=1;i<=n;i++)
{
System.out.print("Enter First Name:");
firstname = aa.nextLine();
System.out.print("Enter Last Name:");
lastname = aa.nextLine();
System.out.print("Enter Zip Code:");
zipcode = aa.nextInt();
aa.nextLine();
Address ad = new Address(firstname,lastname,zipcode);
addr.add(ad);
}
System.out.println("\nFirstName/LastName/Zipcode");
System.out.println();
for(Address a:addr)
{
System.out.println(a);
}
}
}
In: Computer Science
C programming
#include <stdio.h>
#include <math.h>
int main()
{
printf("============== Problem #1 =================\n");
printf("This should print down from 2 to 0 by 0.1 increments\n");
float f = 2.0;
while (f != 0)
{
printf("%0.1f\n",f);
f = f - 0.1;
}
printf("============== Problem #2 =================\n");
printf("This should find that the average is 5.5\n");
int total_score = 55;
int total_grades = 10;
double avg = total_score/total_grades;
printf("Average: %0.2f\n",avg);
printf("============== Problem #3 =================\n");
printf("If the population increases by 2.5 people per second, how long before the population hits 8 billion?\n");
float current_population = 7600000000;
float increase_per_second = 2.5;
printf("Counting...\n");
int second_count = 0;
while (current_population != 8000000000)
{
current_population += increase_per_second;
second_count++;
}
printf("It will be %d seconds from now.\n",second_count);
return(0);
}
Activity 1: Fix the first problem
The first part of this program should print from 2.0 to 0.0 in decrements of
0.1. It starts off good but then the program doesn't end. Figure out why and
fix the program so it terminates (in that loop at least).
Activity 2: Fix the second problem
The second part should calculate the average when given a total of 55 over 10
sample points. The average should be 5.5 but instead, 5.0 is printed out. Find
and fix that problem.
Activity 3: Fix the third problem
The third part is supposed predict the exact second that the world population
will hit 8000000000. It starts with the current population 7600000000 and adds
2.5 people per second. This is the net population increase per
second. Unfortunately, it seems that it never gets to 8000000000.
In: Computer Science