578 Topics
| |
I've just started Python and need to write a program that tells if a string is a palindrome. Here is what I have so far. [CODE] def palp(word): if len(word) < 2: return True left_index = (0) right_index = len(word) - 1 while len(left_index) <> len(right_index): return False if left_index … | |
Hello again! I was given an assignment the other day in C++ and I was suppose to use the counter and add a sentinel so the program knew when to stop. Instructors directions: "The file for this assignment reads a sequence of positive integers from a file (2 3 5 … | |
[CODE] float i = 55 ; float y = 23 ; float u = i / y ; System.out.println(u); [/CODE] i want to print u Round to five decimal places how i can do this approximation ? | |
So I am supposed to write a class that converts fahrenheit to celsius (& vice versa), calculates the volume of a sphere after a radius is entered, and calculates the hypotenuse of a right triangle, all using nothing but static methods. Here is what I have so far; [CODE]class Fun … | |
I have this problem: [CODE]struct Position { float x; float y; float z; }; bool CheckCollision(Position *vertices, int numvertices, Position start, Position end) { //return true if there was NOT a collision with the polygon defined by the vertices and the vector defined by the two positions. }[/CODE] I dont … | |
I am trying to use functions in the following program. The program is supposed to use a vector of structures to store a students first name, last name, and grades. Also, to get a average for each student and a class average. I do not think I am calling the … | |
i want to ask something about my assignment. heres the code [CODE]#include <stdio.h> int main() { int nilaiuts[5],nilaiuas[5],nilaitugas[5]; int i; float total=0; printf("Masukkan nilai UTS mahasiswa [5 mahasiswa] :\n"); // proses memasukkan data ke array for (i = 0; i < 5; i++) { printf("Mahasiswa %i : ", i+1); scanf("%i",&nilaiuts[i]); … | |
This is the program I need to write: At each step the user is asked if she wants another number. If she does, the program adds a random number between 1 and 10 onto her total. The game ends when she quits, or when her total is 18 or higher. … | |
So I need help on how to calculate how much change to give back to a customer. I need the program to give change in the least bills and coins as possible. Ex. Customer's item costs $13.37. He/She pays $20. Program gives back: One $5 Bill One $1 Bill Two … | |
I am currently making my project and it involves graphing functions. I have chosen Java because as I have surfed the net, i was able to download a library (JGraphT) that tells me that it can help me graph mathematical functions. Now, my problem is, i dont know how to … | |
[CODE]Option Explicit Private Sub cmdExit_Click() End End Sub Private Sub cmdRun_Click() Dim num(19) As Integer Dim i As Integer Dim sum As Integer grd.Rows = 2 grd.Cols = 2 grd.Clear For i = 0 To 19 Step 1 num(i) = InputBox("Enter any integer") lstno.AddItem (num(i)) Next i grd.TextMatrix(0, 0) = … | |
I have to do my first assignment for my java class for friday this week. So due in 3 days. I wrote the polynomial class but haven't done the driver for it yet as i don't know if my polynomial class is good. Please check and let me know if … | |
Hi. I'm trying to multiply fractions. How can I take '1 1/2' and multiply it to get 3? (is there some special format like '1-1/2' that I need to use to multiply it?) Thanks | |
Hi. I need a function which will convert a decimal to a fraction, so that I can put in [CODE]echo dec2frac(1.75);[/CODE] and it'll output 1 3/4. Any suggestions? Thanks | |
Roman numbers is a standard programming exercise, to give it a small twist, we input roman numeral, turn it to value and prepare minimal version of it using the substraction rule. Correctness of the input is not checked so Garbage in - Garbage out. | |
I want to produce a moving average for a time series using the JFreeChart MovingAverage.createMovingAverage method in org.jfree.data.time.MovingAverage. But my data is a countdown, i.e. the values for the time parameter are counting down. So when I apply this moving average function it produces a moving average counting up not … | |
I want to find the average score of a LinkedList. My code is [CODE]/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package bowlinggame; import java.util.LinkedList; import java.util.TreeSet; public class BowlingGame { public static void main(String[] args) { TreeSet <String>PlayerNames … | |
What polar coordinates are is explained [url=http://en.wikipedia.org/wiki/Polar_coordinate_system]here[/url]. I wanted to draw some polar functions myself, so I changed my [url=http://www.daniweb.com/software-development/csharp/code/217204]plotting class [/url] a bit and added a polar struct to a new project.. Just posted code for the Plot class and the polar point structure here. You can find an … | |
Here's a code to find out if the number is palindrome or not. [CODE] #include <stdio.h> int main() { int num,chknum1,chknum2=0,i,rmndr;/*here rmndr is remainder after mod,chknum is reversed num*/ printf("enter the number"); scanf("%d",&num); chknum1=num;/*saving num,since it is manipulated*/ for(i=0;i<=sizeof(chknum1);i++) { rmndr=num%10; num=num/10; chknum2=chknum2*10+rmndr; } printf("chknum1 %d,chknum2 %d",chknum1,chknum2); //if(chknum1=chknum2) //printf("Is palindrome"); … | |
I can't seem to get this to compile for nothing; I'm new to this c++ any help out there? [CODE]#include <iostream> int main() { //declare variables double average = 0; double sum = 0; double array[10]; int k; // User Input and Total of number input for (k =0; k … | |
I'm trying to make a price calculator for my friend's car shipping company. It seemed like a simple thing to do but with my skills I'm having some problems. The calculator takes the distance from zipcode 1 to zipcode 2, and mutplies the total miles by .32 to get the … | |
As [URL="http://www.daniweb.com/software-development/c/threads/377568/1625821#post1625821"]Goddess Narues' C code in C forum[/URL] was over my head and her critique of simplistic solution maybe overflowing the integer range was valid in C, I worked out a recursive solution more suitable to my brain in my preferable language. Maybe one day I put in C, now … | |
I am trying to write a function that will count test scores that fall in a specific range(90-100, 89-80, 79-70, 69-60 and 60 or below) that are stored in a two dimensional array. Also, I am supposed to write a function that will do the same as above, only this … | |
[ATTACH=right]21490[/ATTACH]Imagine lining up 57.5 billion Apple iPads to build a wall measuring about 4000 miles long and 60 feet high. To put that into perspective, think of the Great Wall of China cloned and stacked on one top of the other, that's how big we are talking here folks. Now … | |
Hi all, I just make a program and I get in trouble about set method.so anyone can help me? [CODE] import java.util.LinkedList; public class Polynomial { private LinkedList<Integer> coeff = new LinkedList<Integer>(); private int deg = 0; /* Constructs a new polynomial of degree zero */ public Polynomial() { } … | |
i'm trying to add two fractions via a function and it works. the problem is that i have to print the fraction in the main( and i have absolutly no idea how to do that) other than that the program works fine. [CODE]#include<stdio.h> #include<conio.h> #include<iostream.h> int frac(int,int,int,int); void main() { … | |
I have a table similar to the one below: Month | Item | Qty | Cost of Items purchased Jun | 1 | 10 | 50 May | 1 | 5 | 0 Apr | 1 | 5 | -18 Mar | 1 | 7 | 0 Feb | 1 … | |
How to calculate the sum & product of dis-similar numbers of an array[10]. i do have a code but it stop working after a certain limit, so please help..... | |
Good day to everyone:) , i'm a new user here and i'm also new to Visual Basic , i'm having problems coding the codes myself. It's an assignment for me from school , after attemtping it for a few hours , I'm almost finish but i'm having trouble in the … | |
the following program is to print all possible sum combinations of a number for example 6=1+5,2+4,3+3,1+1+4,1+2+3 12=3+9,4+8,5+7,.......,1+1+2+3+5 but i m not getting any output...maybe there's a problem with proper ending of loops pls help[CODE]import java.io.*; public class sumpermutations { public void main()throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int input,i,j,d=0,s=0,num=0,d1=0; … |
The End.