Module 1 Lab 1
.JPG
keyboard_arrow_up
School
Southern New Hampshire University *
*We aren’t endorsed by this school
Course
-140-X3921
Subject
Computer Science
Date
Dec 6, 2023
Type
JPG
Pages
1
Uploaded by PresidentMousePerson992
LAB
1
2
3
4
5
6
7
8
el
10
11
12
activiry
|
1-25.1:
LAB:
Warm
up:
Variables,
input,
and
type
conversion
5/5
main.py
Load
default
template...
user_int
=
int(input('Enter
integer
(32
-
126):\n'))
user_float
=
float(input('Enter
float:\n'))
user_character
=
input('Enter
character:\n')
user_string
=
input('Enter
string:\n')
print(user_int,
user_float,user_character,user_string)
print(user_string,user_character,
user_float,user_int)
print(user_int,
'converted
to
a
character
is',chr(user_int))
#
FIXME
(1):
Finish
reading
other
items
into
variables,
then
output
the
four
values
on
a
single
line
separated
by
a
space
#
FIXME
(2):
Output
the
four
values
in
reverse
#
FIXME
(3):
Convert
the
integer
to
a
character,
and
output
that
characten
When
done
developing
your
program,
press
the
Submit
for
grading
button
below.
This
will
submit
your
program
for
auto-grading.
Discover more documents: Sign up today!
Unlock a world of knowledge! Explore tailored content for a richer learning experience. Here's what you'll get:
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
Java - Functions with 1D Arrays
Create a program that asks the user for the size of an integer array and the elements of the array.
Then, create a function called maxArray() with the following details:
Parameters:
An integer array
The size of the integer array
Return type - int
Return value - the maximum value of the integer array
Call the function you created in the main and pass the integer array and its size to it. Make sure to store the return value in a variable so you could print it afterwards.
Input
1. First line contains the size of the array
2. Succeeding lines are the elements of an array
3. First line contains the size of the array
4. Succeeding lines are the elements of an array
5. First line contains the size of the array
6. Succeeding lines are the elements of an array
7. First line contains the size of the array
8. Succeeding lines are the elements of an array
Output
Enter size of array: 5
Enter element 1: 1
Enter element 2: 2
Enter…
arrow_forward
Functions with 2D Arrays in Java
Write a function named displayElements that takes a two-dimensional array, the size of its rows and columns, then prints every element of a two-dimensional array. Separate every row by a new line and every column by a space.
In the main function, call the displayElements function and pass in the required parameters.
Output
1 2 3
4 5 6
7 8 9
arrow_forward
Find the C program language
Breaking the Code
by CodeChum Admin
ATTENTION SOLDIER!
This will be the hardest mission of your life. Our
intelligence department has caught the enemy sending
codes from one base to another. These enemy codes
can either be a simple communication message or a
mastermind plan.
Our intelligence department has determined that a
mastermind plan is a code that has at least 1 consonant
character.
Since you know programming, your task is to check a
code if it is a mastermind plan or not.
arrow_forward
Please code in C++ use comments and explain your code.
arrow_forward
C++ code not Java
arrow_forward
Parallel Array in Java
Summary
In this lab, you use what you have learned about parallel arrays to complete a partially completed Java program. The program should either print the name and price for a coffee add-in from the Jumpin’ Jive coffee shop or it should print the message: "Sorry, we do not carry that.".
Read the problem description carefully before you begin. The data file provided for this lab includes the necessary variable declarations and input statements. You need to write the part of the program that searches for the name of the coffee add-in(s) and either prints the name and price of the add-in or prints the error message if the add-in is not found.
Instructions
Study the prewritten code to make sure you understand it.
Write the code that searches the array for the name of the add-in ordered by the customer.
Write the code that prints the name and price of the add-in or the error message, and also write the code that prints the total order cost.
Execute the program…
arrow_forward
JAVA Programming Problem 5 – CharacterArray
Write a program which will store the following string into a character array:
6901 Sudley Road Manassas VA
Your program will display each original character, determine and display whether the character is a digit or a letter, and redisplay the character according to the directions below.
Directions
Create a class called CharacterArray.
The scanner class is not required. Initialize the character array with the given string.
Write a program which will accept an alpha numeric string at the keyboard.
Store the string, of any length, into a character array, for example: RBDB Manassas Campus 6901 Sudley Road Manassas VA 20109
For each visible character:
Display the original character
Determine and display whether the character is a digit or a letter
If the character is a lower case letter, redisplay the character in upper case
If the character is a upper case letter, redisplay the character in lower case
If the character is a digit, display it…
arrow_forward
In c++, please and thank you!
Write a function that dynamically allocates an array of integers. The function should accept an integer argument indicating the number of elements to allocate. The function should return a pointer to the array.
arrow_forward
C++ Code Dynamic Arrays
arrow_forward
Use c++ Programming language
Write a program that creates a two dimensional array initialized with test data. Use any data type you wish . The program should have following functions:
.getAverage: This function should accept a two dimensional array as its argument and return the average of each row (each student have their average) and each column (class test average) all the values in the array.
.getRowTotal: This function should accept a two dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a row in the array. The function should return the total of the values in the specified row.
.getColumnTotal: This function should accept a two dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a column in the array. The function should return the total of the values in the specified column.
.getHighestInRow: This function should accept a two…
arrow_forward
for java please
Please submit the pseudocode of your program for your project below.
Need a class which will contain:
Student Name
Student Id
Student Grades (an array of 3 grades)
A constructor that clears the student data (use -1 for unset grades)
Get functions for items a, b, and c, average, and letter grade
Set functions for items a, n, and c
Note that the get and set functions for Student grades need an argument for the grade index.
Need another class which will contain:
An Array of Students (1 above)
A count of number of students in use
You need to create a menu interface that allows you to:
Add new students
Enter test grades
Display all the students with their names, ids, test grades, average, and letter grade
Exit the program
Add comments and use proper indentation.
Nice Features:
I would like that system to accept a student with no grades, then later add one or more grades, and when all grades are entered, calculate the final average or grade.
I would like the system…
arrow_forward
java C++ pleaae i just need the code
arrow_forward
Java please
Create a program to enter grades and calculate averages and letter grades.
Need a class which will contain:
Student Name
Student Id
Student Grades (an array of 3 grades)
A constructor that clears the student data (use -1 for unset grades)
Get functions for items a, b, and c, average, and letter grade
Set functions for items a, n, and c
Note that the get and set functions for Student grades need an argument for the grade index.
Need another class which will contain:
An Array of Students (1 above)
A count of the number of students in the use
You need to create a menu interface that allows you to:
Add new students
Enter test grades
Display all the students with their names, ids, test grades, average, and letter grade
Exit the program
Add comments and use proper indentation.
Nice Features:
I would like that system to accept a student with no grades, then later add one or more grades, and when all grades are entered, calculate the final average or grade.
I would like…
arrow_forward
#include <string>#include <iostream>#include <vector>#include <sstream>#include <exception>class CAT{public:float weight() const{return weight_;}unsigned int range() const{return range_;}CAT(float weight= 1.0, unsigned int range=1);int set_weight(float);int set_range(unsigned int power);int dig(double hours);int id() const{return id_;}private:float weight_;unsigned int range_;const int id_;};int compare(CAT,CAT);
Task:
Define the public function int CAT::set_range(unsigned int power) :
If the value passed by power is smaller than 100 and at same time range_ is smaller or equal to 100, then range_ is set to the sum of power and 2. After this -1 is the return value of the function.
Else If the value passed by power is smaller than range_ , then range_ is to be set to power times 100 and then power times -1 is the return value of the function.
Else If the value passed by power is larger or equal to the value of range_ ,then the function should set…
arrow_forward
#include <string>#include <iostream>#include <vector>#include <sstream>#include <exception>class CAT{public:float weight() const{return weight_;}unsigned int range() const{return range_;}CAT(float weight= 1.0, unsigned int range=1);int set_weight(float);int set_range(unsigned int power);int dig(double hours);int id() const{return id_;}private:float weight_;unsigned int range_;const int id_;};int compare(CAT,CAT);
Task:
Define the parameterized constructor: CAT::CAT(float weight, unsigned int range):
Provide a try-catch block as part of the constructor. Inside the try block, the function set_weight( ) is to be called with the argument weight.
In the catch block, pass the exception message via << to std::cout
Then weight_ is to be set in the following way:
If range is smaller than 10, weight_ should be set to range
In all other cases weight_ is to be set to weight_ times -1
After the try-catch block, proceed as follows:
Assigned range to…
arrow_forward
Instructions
Write a program in C++ that uses a two-dimensional array to store the highest and lowest temperatures for each month of the year. The program should output the average high, average low, and the highest and lowest temperatures for the year. Your program must consist of the following functions:
Function getData: This function reads and stores data in the two-dimensional array.
Function averageHigh: This function calculates and returns the average high temperature for the year.
Function averageLow: This function calculates and returns the average low temperature for the year.
Function indexHighTemp: This function returns the index of the highest high temperature in the array.
Function indexLowTemp: This function returns the index of the lowest low temperature in the array.
These functions must all have the appropriate parameters.
An example of the program is shown below:
Enter high temperature for each month 60 68 72 72 73 76 80 81 75 72 67 66 Enter low temperature for…
arrow_forward
c++
arrow_forward
using c#
Write a function/method called “addItem” that takes:
An array of items
The number of items in the array
An integer representing a barcode
A string representing the name of an item
A string representing the description of an item
A double value representing the price
The function must create and add the item to the array if there is space. The function must return “true” if the addition was successful and “false” otherwise.
arrow_forward
In c++
Write a function named "eliminate_duplicates" that takes an array of integers in random order and eliminates all the duplicate integers in the array. The function should take two arguments: (1) an array of integers; (2) an integer that tells the number of cells in the array. The function should not return a value, but if any duplicate integers are eliminated, then the function should change the value of the argument that was passed to it so that the new value tells the number of distinct integers in the array. Here is an example. Suppose the array passed to the function is as shown below, and the integer passed as an argument to the function is 11.0 | 1 | 2 | 3 | 4 |5 | 6 | 7 | 8 | 9 | 10|(index)58 | 26 | 91 | 26 | 70 | 70 | 91 | 58 | 58 | 58 | 66 (values)
Then the function should alter the array so that it looks like this:
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10| 58 | 26 | 91 | 70 | 66 | ?? | ?? | ?? | ?? | ?? | ??
and it should change the value of the argument so that it is…
arrow_forward
Create a dynamic array that contains an int array. dynamic array, array inside when the existing array is full and a new element needs to be added will double its size, make all the elements of the old array the same will copy the indexes and add the element to the new array. Use the following functions. Write in C language.
1.append(dynamic array, new element): function sent to itself Adds the element sturct to the end of the array inside DynamicArray. Place If not, it behaves in accordance with the dynamic array definition given above.
2. get(index): The element in the index sent to it by the function takes it from the array it hosts and sends it back.
ATTENTION ! : Please use a dynamic array and this array with struct structure. I don't want a link list. Do not post wrong or copied codes.
Be sure to use the append and get functions given above
Please do not solve the question I asked with the same code and copy and paste the code, my right to the question is running out.
Solve the…
arrow_forward
Create a dynamic array that contains an int array. dynamic array, array inside when the existing array is full and a new element needs to be added will double its size, make all the elements of the old array the same will copy the indexes and add the element to the new array. Use the following functions. Write in C language.
1.append(dynamic array, new element): function sent to itself Adds the element sturct to the end of the array inside DynamicArray. Place If not, it behaves in accordance with the dynamic array definition given above.
2. get(index): The element in the index sent to it by the function takes it from the array it hosts and sends it back.
Do not use link lists. Solve the question using array.
arrow_forward
IT is a project
Create a program to enter grades and calculate averages and letter grades.
Need a class which will contain:
Student Name
Student Id
Student Grades (an array of 3 grades)
A constructor that clears the student data (use -1 for unset grades)
Get functions for items a, b, and c, average, and letter grade
Set functions for items a, n, and c
Note that the get and set functions for Student grades need an argument for the grade index.
Need another class which will contain:
An Array of Students (1 above)
A count of the number of students in the use
You need to create a menu interface that allows you to:
Add new students
Enter test grades
Display all the students with their names, ids, test grades, average, and letter grade
Exit the program
Add comments and use proper indentation.
Nice Features:
I would like that system to accept a student with no grades, then later add one or more grades, and when all grades are entered, calculate the final average or grade.
I would…
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Related Questions
- Java - Functions with 1D Arrays Create a program that asks the user for the size of an integer array and the elements of the array. Then, create a function called maxArray() with the following details: Parameters: An integer array The size of the integer array Return type - int Return value - the maximum value of the integer array Call the function you created in the main and pass the integer array and its size to it. Make sure to store the return value in a variable so you could print it afterwards. Input 1. First line contains the size of the array 2. Succeeding lines are the elements of an array 3. First line contains the size of the array 4. Succeeding lines are the elements of an array 5. First line contains the size of the array 6. Succeeding lines are the elements of an array 7. First line contains the size of the array 8. Succeeding lines are the elements of an array Output Enter size of array: 5 Enter element 1: 1 Enter element 2: 2 Enter…arrow_forwardFunctions with 2D Arrays in Java Write a function named displayElements that takes a two-dimensional array, the size of its rows and columns, then prints every element of a two-dimensional array. Separate every row by a new line and every column by a space. In the main function, call the displayElements function and pass in the required parameters. Output 1 2 3 4 5 6 7 8 9arrow_forwardFind the C program language Breaking the Code by CodeChum Admin ATTENTION SOLDIER! This will be the hardest mission of your life. Our intelligence department has caught the enemy sending codes from one base to another. These enemy codes can either be a simple communication message or a mastermind plan. Our intelligence department has determined that a mastermind plan is a code that has at least 1 consonant character. Since you know programming, your task is to check a code if it is a mastermind plan or not.arrow_forward
- Please code in C++ use comments and explain your code.arrow_forwardC++ code not Javaarrow_forwardParallel Array in Java Summary In this lab, you use what you have learned about parallel arrays to complete a partially completed Java program. The program should either print the name and price for a coffee add-in from the Jumpin’ Jive coffee shop or it should print the message: "Sorry, we do not carry that.". Read the problem description carefully before you begin. The data file provided for this lab includes the necessary variable declarations and input statements. You need to write the part of the program that searches for the name of the coffee add-in(s) and either prints the name and price of the add-in or prints the error message if the add-in is not found. Instructions Study the prewritten code to make sure you understand it. Write the code that searches the array for the name of the add-in ordered by the customer. Write the code that prints the name and price of the add-in or the error message, and also write the code that prints the total order cost. Execute the program…arrow_forward
- JAVA Programming Problem 5 – CharacterArray Write a program which will store the following string into a character array: 6901 Sudley Road Manassas VA Your program will display each original character, determine and display whether the character is a digit or a letter, and redisplay the character according to the directions below. Directions Create a class called CharacterArray. The scanner class is not required. Initialize the character array with the given string. Write a program which will accept an alpha numeric string at the keyboard. Store the string, of any length, into a character array, for example: RBDB Manassas Campus 6901 Sudley Road Manassas VA 20109 For each visible character: Display the original character Determine and display whether the character is a digit or a letter If the character is a lower case letter, redisplay the character in upper case If the character is a upper case letter, redisplay the character in lower case If the character is a digit, display it…arrow_forwardIn c++, please and thank you! Write a function that dynamically allocates an array of integers. The function should accept an integer argument indicating the number of elements to allocate. The function should return a pointer to the array.arrow_forwardC++ Code Dynamic Arraysarrow_forward
- Use c++ Programming language Write a program that creates a two dimensional array initialized with test data. Use any data type you wish . The program should have following functions: .getAverage: This function should accept a two dimensional array as its argument and return the average of each row (each student have their average) and each column (class test average) all the values in the array. .getRowTotal: This function should accept a two dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a row in the array. The function should return the total of the values in the specified row. .getColumnTotal: This function should accept a two dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a column in the array. The function should return the total of the values in the specified column. .getHighestInRow: This function should accept a two…arrow_forwardfor java please Please submit the pseudocode of your program for your project below. Need a class which will contain: Student Name Student Id Student Grades (an array of 3 grades) A constructor that clears the student data (use -1 for unset grades) Get functions for items a, b, and c, average, and letter grade Set functions for items a, n, and c Note that the get and set functions for Student grades need an argument for the grade index. Need another class which will contain: An Array of Students (1 above) A count of number of students in use You need to create a menu interface that allows you to: Add new students Enter test grades Display all the students with their names, ids, test grades, average, and letter grade Exit the program Add comments and use proper indentation. Nice Features: I would like that system to accept a student with no grades, then later add one or more grades, and when all grades are entered, calculate the final average or grade. I would like the system…arrow_forwardjava C++ pleaae i just need the codearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,