C# Visual Studios HelloWorld
For this assignment, you'll be given two arrays where one represents the item numbers and the other array represents the price of the item. For instance, index 3 in the items array will have the corresponding price for the item in index 3 of the price array. You'll ask the user which item to lookup, search the array for the item, and print the price when the item is found. When the item was not found, print, Item not found.
Sample
When item exists:
Enter an item number. 98 Price for item 98 is $4.04
When item doesn't exist:
Enter an item number. 33 Item not found
#source code:
using System;
class HelloWorld {
static void Main() {
int[] itemnum={34,56,98,45,63};
double[] price={3.02,7.8,4.04,8.2,2.3};
Console.Write("Enter an item number.");
int status=0,itemindex=0;
int item = Convert.ToInt32(Console.ReadLine());
for(int i=0;i<itemnum.Length;i++){
if(itemnum[i]==item){
status=1;
itemindex=i;
break;
}
}
if(status==1){
Console.Write("Price for item "+item+" is
$"+price[itemindex]);
}else{
Console.Write("Item not found");
}
}
}
#source code along with output:
![main.cs 1 using System; 2. class HelloWorld { 3 static void Main() { int[] itemnum={34,56,98,45,63}; double[] price={3.02,7.8](http://img.homeworklib.com/questions/efb7d1a0-04f3-11eb-bb3d-9b0b4c357042.png?x-oss-process=image/resize,w_560)
C# Visual Studios HelloWorld For this assignment, you'll be given two arrays where one represents the...
C# Visual Studios HelloWorld For this assignment, you'll work with first creating an array and populating it's values. Then, we'll use the values in the array to calculate the average. Since it's common for an average to result in numbers with decimal points, the array you create should be of type double[]. This program will need to use dynamic input from the user so perform the following steps: Ask the user how many numbers need to be added. Use this...
In C++ 1. Write a program that allows a user to enter 10 integer values from the keyboard. The values should be stored in an array. 2. The program should then ask the user for a number to search for in the array: The program should use a binary search to determine if the number exists in a list of values that are stored in an array (from Step #1). If the user enters a number that is in the...
Arrays Arravs Introduction Your ninth programming assignment will consist of two C++programs. Your programs should compile correctly and produce the specified output. Please note that your programs should comply with the commenting and formatting rules we discussed in class. Please see the descriptive ile on eLearning for details. Program 1- Linear Search Algorithm In Computer Science, it is often very important to be able to locate a specific data item inside a list or collection of data. Algorithms that perform...
Create a C# Console app Project in Visual Studios Menu: Room number Amenities Price 111 1 king size bed $130.00 112,113,114 2 double beds $145.00 211,212 1 queen size bed $125.00 213 1 double bed and 1 sofa bed $170.50 Write a program called HotelReservations that prompts a guest for a room number. Once the room selection is made, display the amenities and price for the room. Allow the guest to continue choosing multiple rooms if desired (displaying the amenities...
Please help me!
For Problem 1, 2 and 3: You are required to submit three .c
files that contain the instructions that you have written to solve
the following problems. Place the C source code to solve the first
problem in a file called lab5a.c. Place the C source code to solve
the second problem in a file called lab5b.c. And place the C source
code to solve the third problem in a file called lab5c.c. Remember
to include your...
c++. please show screenshots of output
This project will continue to familiarize the student with using arrays. Store all the function proto-types in project11_funch and store all the functions in project11_func.cpp. Make sure you have proper header comments in each.h,.cpp file. When you run your program, your sample output should show your name. Your report should include the following: 1) project11_func.h 2) project11_func.cpp 3) project11.cpp 4) sample output Write the following functions: a) void fill_array_with_random_nums(int array(), int N): Fill array...
USE JAVA: Given the Interface Code and the Interface Implementation Code; Write Junit Tests to test all fuctionality. ------------- Interface code: public interface CustomList { /** * This method should add a new item into the CustomList and should * return true if it was successfully able to insert an item. * @param item the item to be added to the CustomList * @return true if item was successfully added, false if the item was not successfully added (note: it...
Assignment 5 will be way different. It will be more like what
you will receive in a programming shop. By that I mean that some
things are built for you and others you will need to create or
finish. P.S. part of your grade will include: Did you add in the
required files? Did you rename your project? does your linear
searches work? Did you put your code in the correct modules? did
you change modules that you weren't supposed...
Your assignment is to write a grade book for a teacher. The
teacher has a text file, which includes student's names, and
students test grades. There are four test scores for each student.
Here is an example of such a file:
Count: 5
Sally 78.0 84.0 79.0 86.0
Rachel 68.0 76.0 87.0 76.0
Melba 87.0 78.0 98.0 88.0
Grace 76.0 67.0 89.0 0.0
Lisa 68.0 76.0 65.0 87.0
The first line of the file will indicate the number of students...
All code will be in Java, and there will be TWO source code. I. Write the class MailOrder to provide the following functions: At this point of the class, since we have not gone through object-oriented programming and method calling in detail yet, the basic requirement in this homework is process-oriented programming with all the code inside method processOrderof this class. Inside method processOrder, we still follow the principles of structured programming. Set up one one-dimensional array for each field: product...