Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

Alex501

@Alex501
About
Posts
15
Topics
11
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • I need help with C#
    A Alex501

    I can't compile this code in visual studio I get an error. Could somebody help me. class Recurse { public void foo(int f) { Console.WriteLine("Handed "+f); if (f < 0) return; if ( f % 2 == 0) this.foo(f - 5); else this.foo(f + 1); } } class What_Does_This_Code_Print { public void RunExercise() { Recurse recurser = new Recurse(); recurser.foo(10); } }

    C# csharp help visual-studio

  • Help me with a program.
    A Alex501

    Welcome to The Quiz Program! You can be quizzed on any of the following operators: 1) % (modulus, or 'remainder') 2) * (multiplication) 3) / (integer division) 4) / % (integer division & modulus in a combined challenge! Type the number of the operator that you wish to be quizzed on: 1 I will ask you to tell me the result of A % B What is the smallest value of A: 0 What is the largest value of A: 100 What is the smallest value of B: 40 What is the largest value of B: 50 How many times do you wish to be quizzed: 3 Ok, we're ready to go! What is the result of 92 % 44? 4 4 is correct! What is the result of 92 % 48? 4 Good try, but no: 92 % 48 = 44 What is the result of 18 % 47? 47 Good try, but no: 18 % 47 = 18 Thank you for using this program - have a nice day! Press the 'Return' key to exit Here's my code I'm stuck have no idea what to do next. class Program { class DoLoop { public static void Main() { string myChoice; do { // Print A Menu Console.WriteLine("Welcome to The Quiz Program!\n You can be quizzed on any of the following operators:"); Console.WriteLine("1) % (modulus, or 'remainder')"); Console.WriteLine("2 (multiplication)"); Console.WriteLine("3 - (integer division)"); Console.WriteLine("4 - integer division & modulus in a combined challenge!)"); Console.WriteLine("Choice (1,2,3,or 4): "); // Retrieve the user's choice myChoice = Console.ReadLine(); // Make a decision based on the user's choice switch(myChoice) { case "1": Console.WriteLine("I will ask you to to tell me the result of\n A % B"); break;

    C# help question

  • I need help with errors.
    A Alex501

    I dont know how to fix my error. Could someone help me out. I use C# expression. namespace ConsoleApplication1 { private void rand_seed() { int seed = (int)(time(0)); RandomNumbers.Seed(seed); } private double get_RandomNum(double x, double y) { return x + (y - x) * RandomNumbers.NextNumber() * (1.0 / RAND_MAX); } private static int Main() { rand_seed(); double x_cor = 0; double y_cor = 0; double x_sum = 0; double y_sum = 0; double x_y_total = 0; int num_darts = 0; int num_hits = 0; int num_misses = 0; double pi_approx = 0; Console.Write(" Throw the dart: "); num_darts = SimulateCin.ReadToWhiteSpace(true); Console.Write("\n"); if (num_darts != 0) { for (int i = 0; i < num_darts; i++) // Start of for loop inside the while loop { x_cor =get_RandomNum(1.0, -1.0); y_cor =get_RandomNum(-1.0, 1.0); x_sum = (x_cor * x_cor); y_sum = (y_cor * y_cor); x_y_total = Math.Sqrt(x_sum + y_sum); if (x_y_total <= 1) { num_hits++; } else { num_misses++; } } } // end of if loop pi_approx = (1.0 * num_hits /num_misses); Console.Write(" The value is "); Console.Write(pi_approx); Console.Write("\n"); return 0; } }

    C# help csharp tutorial

  • I need help with a program
    A Alex501

    I need to create code that goes through the array, and for each empty slot, allocate a Student object. You should assign the new object a Student ID number that is the same as the slot in the array (i.e., if slot #7 is blank, create a Student object with ID # 7). You should NOT destroy any existing Student objects How should I start this assignment.

    C# data-structures help

  • I need help with a progra.
    A Alex501

    Could someone help me out with this program? Draw the circle on a sheet of paper. Remember how big the paper is (how high & how wide, which gives us the total area), and how big the circle is. 2. Randomly pick points on the paper (say, by throwing darts). For each point we randomly pick, we'll do the following: a. If the point is inside (or on the line of) the circle, we'll increment our counter that keeps track of the number of points that landed inside the circle. b. If the point isn't inside/on the circle, and you need to, and increment another counter to keep track of that. c. Either way, increment your "How many times did I pick a point?" counter d. Darts that fall outside the paper are ignored entirely. Even better would be to find a way to make sure that your randomly selected points never end up outside the paper in the first place. 3. Once you're done throwing all the darts in step 2, figure out what percentage of the darts fell inside the circle. As an example, let's say you threw 1,000 darts, 534 of them landed inside/on the boundary of the circle, and 466 landed outside the circle, but on the paper. Thus, 53.4% of the darts landed in the circle. 4. Figure out how big the sheet of paper is (what the total area is). As a continuing example, let's say that the paper is 100 inches wide, and 200 inches tall, for a total area of (100x200=20,000) 5. Estimate that the area of the circle to be the size of the paper, multiplied by the percentage of points that were inside the circle. As a continuing example, we'll estimate that the size of the circle is 53.4% of 20,000, or (20,000 * .534=) 10,680 square inches. The downside is that this is computationally intensive (i.e., you can't really do this by hand). The upside is that this works for *ANY* shape, no matter how complicated. For this homework assignment, we'll stick with circles, and only circles. Your task is to write a program that will demonstrate how accurate this method is, depending on how many points you randomly select. Basically, you're going to go through, and use the Monte Carlo method to estimate the area of the circle, then use the real formula to find the actual area, then compare the two. The 'error' here will be measured as the percentage difference between the estimated & real circle (so if the circle is 314 units in size, and the estimate is 0, then the error is -100%, meaning that we're 100% below the real size. If the estimate is 345.4 uni

    C# help tutorial question

  • I need help how to start this program.
    A Alex501

    say that within each egg carton, the ‘slot’ for each egg is given a number, just like we number arrays. We will also number the egg cartons themselves. So in the picture below, we see that egg carton #0 has 8 slots. Within egg carton #0, the slots are number 0, 1, 2, 3, 4, 5,6, and 7, just like the carton was an array. Another way to number the slots would be to use ‘global slot number’. This is what you’d get, if you started counting at the first slot in the first carton, and then kept counting when you moved on to the second carton, etc, etc. For example, “carton#0, slot#1” would be given the ‘global slot number’ of 1, since you start counting (at carton#0, slot#0) with 0, then count carton#0, slot#1 as ‘global 1’. When you run out space in the first carton (having reached ‘global 7’, at “carton#0, slot#7”), you go on to the second carton, and keep counting. So carton#1, slot#0 is actually ‘global slot number 8’. Carton #1, slot #5 is ‘global slot number 13’, and ‘global slot number 17’ really means carton #2, slot #1. You need to fill in code, in program that is provided below, so that your program will ask the user for the ‘global slot number’ of a particular slot in a particular egg carton, and will then tell the user which carton, and which slot # with that carton, to put the egg.

    C# tutorial data-structures help

  • I need help with a program
    A Alex501

    Hello, I need to write a program that has an output: : 1. The total cost of all the items 2. The total sales tax, which is 8% of the total cost The gratuity (tip). Most people tip either at the 15%, 20%, or 25% level, so tell the user what the 15% tip is, the 20% tip is, and the 25% tip is I wrote everything but I do not know how to add a tip as a 15, 20 and 25 percent, so could someone help me out. class Program { static void Main(string[] args) { // Price of items const decimal PriceOnePizza = 0.95M; const decimal PriceAPairOfHamburger = 2.95M; const decimal PriceOneHotDog = 4.55M; const decimal TaxRate = 0.08M; // 5.75% // Customer personal infoirmation // Unsigned numbers to represent cleaning items uint NumberOfPizza, NumberOfHamburger, NumberOfHotDog; // Each of these sub totals will be used for cleaning items // Values used to process an order decimal TotalOrder, TaxAmount, SalesTotal; Console.WriteLine("-/- Arbys Restaurant -/-"); // Request customer information from the user // Request the quantity of each category of items Console.Write("Number of Pizza: "); string strPizza = Console.ReadLine(); NumberOfPizza = uint.Parse(strPizza); Console.Write("Number of Hamburger: "); string strHamburger = Console.ReadLine(); NumberOfHamburger = uint.Parse(strHamburger); Console.Write("Number of Dresses: "); string strHotDog = Console.ReadLine(); NumberOfHotDog = uint.Parse(strHotDog); // Perform the necessary calculations // Calculate the "temporary" total of the order // Calculate the tax amount using a constant rate TaxAmount = TotalOrder * TaxRate; // Add the tax amount to the total order SalesTotal = TotalOrder + TaxAmount; // Communicate the total to the user... Console.Write("\nThe Total order is: "); Console.WriteLine(SalesTotal); // and request money for the order // Display the receipt Console.WriteLine("===================================="); Console.WriteLine("-/- Arbys Restaurant -/-"); Console.WriteLine("===================================="); Console.Write("Customer: "); Console.WriteLine("------------------------------------"); Console.WriteLine("Item Type Qty Unit/Price Sub-Total"); Console.WriteLine("------------------------------------"); Console.Write("Shirts "); Console.Write(NumberOfPizza); Console.Write(" "); Console.Write(PriceOnePizza); Console.Write(" "); Console.Write(NumberOfHamburger); Console.Write(" ");

    C# sales help tutorial

  • I need to change to Array
    A Alex501

    I'm only in 8th grade and I'm learning C# by myself. So shut up if you do not know.

    C# data-structures help

  • I need to change to Array
    A Alex501

    How do you find an average of three numbers .

    C# data-structures help

  • I need to change to Array
    A Alex501

    I have this code but I need to convert to an array. So this sum program should be in array. Could someone help me out. static void Main(string[] args) { string firstNumber, // first string entered by user secondNumber, thirdNumber; // second string entered by user int number1, // first number to add number2,// second number to add number3,//third number to add sum; // sum of number1, number2, and number3 // prompt for and read first number from user as string Console.Write( "Please enter the first integer: " ); firstNumber = Console.ReadLine(); // read second number from user as string Console.Write( "\nPlease enter the second integer: " ); secondNumber = Console.ReadLine(); Console.Write("\nPlease enter the third integer: "); thirdNumber = Console.ReadLine(); // convert numbers from type string to type int. Note: "int" would have worked as well. number1 = Int32.Parse( firstNumber ); number2 = Int32.Parse( secondNumber ); number3 = Int32.Parse( thirdNumber ); // add numbers sum = number1 + number2 + number3; // display results Console.WriteLine("\nThe sum is {0}.", sum); } } }

    C# data-structures help

  • I need help with prime numbers.
    A Alex501

    Thanks a lot. It was very helpful.

    C# tutorial help question

  • I need help with prime numbers.
    A Alex501

    Thanks a lot. I appreciate a lot. It's not a homework, because I'm learning C# by a book and there was a problem and I could not figure out. Thanks a lot Davey.

    C# tutorial help question

  • I need help with prime numbers.
    A Alex501

    I have this code, but I need to find out how to make it so the program will check if its a prime number or not. For Example: If user types Number Is prime? 1 No – by definition 2 Yes – the only even prime! ? 3 Yes 4 No 5 Yes 7 Yes 17 Yes 18 No 629 ( = 17 * 37) No static void Main(string[] args) { bool current = false; int j; Console.WriteLine("Enter any number/integer"); int num = Int32.Parse(Console.ReadLine()); for (int i = 2; i <= num; i++) { for (j = 2; j < i; j++) { if (i % j == 0) { current = true; break; } } if (current == false) Console.Write("{0} ", j); else current = false; } Console.ReadLine(); } } }

    C# tutorial help question

  • I need to Create a Quiz Program.
    A Alex501

    It should look like this one. Welcome to The Quiz Program! You can be quizzed on any of the following operators: 1) % (modulus, or 'remainder') 2) * (multiplication) 3) / (integer division) 4) / % (integer division & modulus in a combined challenge! Type the number of the operator that you wish to be quizzed on: 1 I will ask you to tell me the result of A % B What is the smallest value of A: 0 What is the largest value of A: 100 What is the smallest value of B: 40 What is the largest value of B: 50 How many times do you wish to be quizzed: 3 Ok, we're ready to go! What is the result of 92 % 44? 4 4 is correct! What is the result of 92 % 48? 4 Good try, but no: 92 % 48 = 44 What is the result of 18 % 47? 47 Good try, but no: 18 % 47 = 18 Thank you for using this program - have a nice day! Press the 'Return' key to exit

    C# question

  • I need help with C# loops
    A Alex501

    I need to create this program and needs to have if, else statements. Could you please help me? I want to create a program that will look like that? Welcome to HollowRectanglePrinter! How many columns wide should the rectangle be? 6 How many rows tall should the rectangle be? 4 Here you go: ****** * * * * ******

    C# csharp help question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups